Chilkat Online Tools

C++ / Atlassian Confluence Cloud / Get theme

Back to Collection Items

#include <CkHttp.h>
#include <CkStringBuilder.h>
#include <CkJsonObject.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttp http;
    bool success;

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");

    CkStringBuilder sbResponseBody;
    success = http.QuickGetSb("https://your-domain.atlassian.net/wiki/rest/api/settings/theme/:themeKey",sbResponseBody);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    CkJsonObject jResp;
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);

    std::cout << "Response Body:" << "\r\n";
    std::cout << jResp.emit() << "\r\n";

    int respStatusCode = http.get_LastStatus();
    std::cout << "Response Status Code = " << respStatusCode << "\r\n";
    if (respStatusCode >= 400) {
        std::cout << "Response Header:" << "\r\n";
        std::cout << http.lastHeader() << "\r\n";
        std::cout << "Failed." << "\r\n";
        return;
    }
    }

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/settings/theme/:themeKey

Postman Collection Item JSON

{
  "name": "Get theme",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/settings/theme/:themeKey",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "settings",
        "theme",
        ":themeKey"
      ],
      "variable": [
        {
          "key": "themeKey",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The key of the theme to be returned."
        }
      ]
    },
    "description": "Returns a theme. This includes information about the theme name,\ndescription, and icon.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**: None"
  },
  "response": [
    {
      "name": "Returned if the requested theme is returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/settings/theme/:themeKey",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "settings",
            "theme",
            ":themeKey"
          ],
          "variable": [
            {
              "key": "themeKey"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "Returned if there is no theme with the given key.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/settings/theme/:themeKey",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "settings",
            "theme",
            ":themeKey"
          ],
          "variable": [
            {
              "key": "themeKey"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}