Fronted endpoint

This is great, was able to convert this into a postman collection. Couple of questions on the API, some calls work as expected using the token returned from the login as the auth token. Calling a /frontends to list all frontends gives me a 401, is there a different auth token that should be used for that?

The /frontends endpoint is used by the zrok admin tooling to manage public frontends. It requires an admin token.

If you're just trying to list the contents of your environment, you want /overview.

Sorry to be naive but where would I get the admin token on a self hosted environment?

It's ZROK_ADMIN_TOKEN in your compose project's .env file since you followed the Docker guide.

1 Like

It's in the zrok controller configuration:

#    _____ __ ___ | | __
#   |_  / '__/ _ \| |/ /
#    / /| | | (_) |   <
#   /___|_|  \___/|_|\_\
# controller configuration
#

# The `v` field determines the configuration version. When software is released that changes the structure of the
# configuration, the software will expect this field to be incremented. This protects you against invalid configuration
# versions and will refer to you to the documentation when the configuration structure changes.
#
v: 4

admin:
  # The `secrets` array contains a list of strings that represent valid `ZROK_ADMIN_TOKEN` values to be used for
  # administration of the `zrok` controller.
  #
  # Change this for your installation.
  #
  secrets:
    -                             77623cad-1847-4d6d-8ffe-37defc33c909

Okay so I see how to get the environments and shares and can unshare using the API. With the API how do I delete an environment?

See the /disable endpoint.

After importing the zrok spec to Insomnia as a "request collection" I still couldn't see any body/data/payload, but when I loaded the spec as a "document" I could see in the Swagger Playground the correct body to send.

cURL example to disable a Docker share's environment which is the same as deleting the environment:

ZROK_ZITI_IDENTITY="$(jq -r '.ziti_identity' ~/.zrok/environment.json)";
curl -sSf \
-XPOST \
-H "content-type: application/zrok.v1+json" \
-H "x-token: ${ZROK_ENABLE_TOKEN}" \
-d "{\"identity\": \"${ZROK_ZITI_IDENTITY}\"}"  \
"${ZROK_API_ENDPOINT}/api/v1/disable"

That did the trick, thanks!

1 Like

I am getting the following on account create:

"message": "path /api/v1/account was not found"

Is this the correct path?

I'm guessing you're running a version of zrok controller that doesn't have the /account endpoint that was just added in v0.4.39.

curl -sSf ${ZROK_API_ENDPOINT}/api/v1/version

That is correct. Thanks