Start · Get started
Quickstart
Make your first API call, create a project and follow a request to the end.
Before you start
You need an organisation on Colossium, and to be an owner or administrator of it, because only they can create tokens. You need curl, and jq if you want tidy output.
Treat the token like a password. Put it in an environment variable, not in a file you will commit, not in a message and never in a URL.
Five steps
Create a token
- Sign in to the console at
https://app.colossium.cloudand open API access. - Choose Create token. Name it after what will use it, for example
quickstart. - Choose the Developer permission set. It can read, create projects and make requests, and cannot delete anything.
- Leave the expiry at 90 days. Choose Create token.
- Copy the token now. It is shown once. Colossium keeps only a hash, so it cannot show it again.
# Keep it out of your shell history and your repository.
read -rs COLOSSIUM_API_TOKEN && export COLOSSIUM_API_TOKEN
export COLOSSIUM_API=https://api.colossium.cloud/v1Check the token
/token/verify says what the token is and what it can do right now. It is the best first call, and a good health check.
curl -sS "$COLOSSIUM_API/token/verify" -H "Authorization: Bearer $COLOSSIUM_API_TOKEN" | jqYou should see "status": "active" and a list of scopes. If you see an error instead, Errors explains each one.
Create a project
Projects group your resources. Pick a slug: lower-case letters, numbers and single hyphens.
curl -sS -X POST "$COLOSSIUM_API/projects" \
-H "Authorization: Bearer $COLOSSIUM_API_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"Quickstart","slug":"quickstart"}' | tee project.json | jq
export PROJECT_ID=$(jq -r .id project.json)Ask for something
Make a request for a storage bucket. Every request needs an Idempotency-Key, which makes it safe to send twice. Why.
curl -sS -X POST "$COLOSSIUM_API/requests" \
-H "Authorization: Bearer $COLOSSIUM_API_TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-bucket-1" \
-d "{\"kind\":\"storage.create\",\"project_id\":\"$PROJECT_ID\",\"input\":{\"name\":\"quickstart-assets\",\"region\":\"eu\"}}" \
| tee request.json | jq
export REQUEST_ID=$(jq -r .id request.json)The answer has "state": "awaiting_approval". Colossium reviews every request before it runs, so this is where it waits.
Follow it, then clean up
# Look at it again, with its progress events:
curl -sS "$COLOSSIUM_API/requests/$REQUEST_ID" -H "Authorization: Bearer $COLOSSIUM_API_TOKEN" | jq '{state, events}'
# Changed your mind? Withdraw it while it has not started:
curl -sS -X POST "$COLOSSIUM_API/requests/$REQUEST_ID/cancel" -H "Authorization: Bearer $COLOSSIUM_API_TOKEN" | jq .stateA request moves through states until it ends as succeeded, failed or cancelled. Requests and approvals explains each state and how long to expect.
Where next
- Make this robust with the client from Build a provisioning tool: retries, idempotency and polling are done for you.
- Understand what a token can and cannot do: Authentication and tokens.
- Revoke the quickstart token in the console when you are finished with it.
This page as MarkdownReport a problem with this pageOlympus Group Holdings, Inc.