Bootstrap FreeKB - Atlassian - Create API token
Atlassian - Create API token

Updated:   |  Atlassian articles

  1. Go to https://id.atlassian.com/manage-profile/security
  2. Select Create and manage API tokens
  3. Create a classic API token and copy the token to your clipboard

On a Linux system, issue the following command, replacing <api token> with the API token that was copied to your clipboard.

More details here => Basic auth for REST APIs

echo -n <your email address>:<api token> | base64 | sed ':label; N; $! b label; s|\n||g'

 

The above command should return a base 64 encoded string. Using the base64 encoded string, you should now be able to submit a GET request and get JSON response. For example, to GET Confluence Spaces. For more details and examples, check out my article FreeKB - Atlassian - List Confluence Spaces using curl.

More GET request examples here => The Confluence Cloud REST API

curl \
--silent \
--request GET \
--header "Accept: application/json" \
--header "Authorization: Basic <base64 encoded string>" \
--url "https://acme.atlassian.net/wiki/api/v2/spaces"| jq

 

Something like this should be returned.

{
  "results": [
    {
      "spaceOwnerId": "557058:73a84e24-c4ab-4afc-b7ca-0050d3ef0f96",
      "createdAt": "2024-10-13T20:11:24.561Z",
      "authorId": "557058:73a84e24-c4ab-4afc-b7ca-0050d3ef0f96",
      "homepageId": "15335585",
      "icon": null,
      "description": null,
      "status": "current",
      "name": "my first space",
      "key": "A1",
      "id": "15335479",
      "type": "global",
      "_links": {
        "webui": "/spaces/A1"
      },
      "currentActiveAlias": "A1"
    }
  ],
  "_links": {
    "next": "/wiki/api/v2/spaces?limit=1&cursor=eyJpZCI6MTUzMzU0NzksInNwYWNlU29ydE9yZGVyIjp7ImZpZWxkIjoiSUQiLCJkaXJlY3Rpb24iOiJBU0NFTkRJTkcifSwic3BhY2VTb3J0T3JkZXJWYWx1ZSI6MTUzMzU0Nzl9",
    "base": "https://acme.atlassian.net/wiki"
  }
}

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter aa309d in the box below so that we can be sure you are a human.