Chilkat Online Tools

unicodeCpp / Atlassian Confluence Cloud / Get look and feel settings

Back to Collection Items

#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkHttpResponseW.h>
#include <CkStringBuilderW.h>

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

    CkHttpW http;
    bool success;

    CkJsonObjectW queryParams;
    queryParams.UpdateString(L"spaceKey",L"<string>");

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

    CkHttpResponseW *resp = http.QuickRequestParams(L"GET",L"https://your-domain.atlassian.net/wiki/rest/api/settings/lookandfeel",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    CkStringBuilderW sbResponseBody;
    resp->GetBodySb(sbResponseBody);

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

    wprintf(L"Response Body:\n");
    wprintf(L"%s\n",jResp.emit());

    int respStatusCode = resp->get_StatusCode();
    wprintf(L"Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        wprintf(L"Response Header:\n");
        wprintf(L"%s\n",resp->header());
        wprintf(L"Failed.\n");
        delete resp;
        return;
    }

    delete resp;

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "selected": "global",
    //   "global": {
    //     "headings": {
    //       "color": "veniam in ex velit"
    //     },
    //     "links": {
    //       "color": "fugiat irure dolor nulla"
    //     },
    //     "menus": {
    //       "hoverOrFocus": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "color": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "header": {
    //       "backgroundColor": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "button": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "primaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "secondaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "search": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "content": {
    //       "screen": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "container": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "header": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "body": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "bordersAndDividers": {
    //       "color": "in"
    //     }
    //   },
    //   "custom": {
    //     "headings": {
    //       "color": "elit aliquip nulla aliqua"
    //     },
    //     "links": {
    //       "color": "aliquip consequat ut occaecat"
    //     },
    //     "menus": {
    //       "hoverOrFocus": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "color": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "header": {
    //       "backgroundColor": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "button": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "primaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "secondaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "search": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "content": {
    //       "screen": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "container": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "header": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "body": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "bordersAndDividers": {
    //       "color": "ut ut"
    //     }
    //   },
    //   "theme": {
    //     "headings": {
    //       "color": "l"
    //     },
    //     "links": {
    //       "color": "qui do laborum ut"
    //     },
    //     "menus": {
    //       "hoverOrFocus": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "color": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "header": {
    //       "backgroundColor": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "button": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "primaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "secondaryNavigation": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "search": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "content": {
    //       "screen": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "container": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "header": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       },
    //       "body": {
    //         "value": "<Error: Too many levels of nesting to fake this schema>"
    //       }
    //     },
    //     "bordersAndDividers": {
    //       "color": "quis dolore"
    //     }
    //   }
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    // Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.

    const wchar_t *selected = jResp.stringOf(L"selected");
    const wchar_t *Color = jResp.stringOf(L"global.headings.color");
    const wchar_t *LinksColor = jResp.stringOf(L"global.links.color");
    const wchar_t *Value = jResp.stringOf(L"global.menus.hoverOrFocus.value");
    const wchar_t *ColorValue = jResp.stringOf(L"global.menus.color.value");
    const wchar_t *BackgroundColorValue = jResp.stringOf(L"global.header.backgroundColor.value");
    const wchar_t *ButtonValue = jResp.stringOf(L"global.header.button.value");
    const wchar_t *PrimaryNavigationValue = jResp.stringOf(L"global.header.primaryNavigation.value");
    const wchar_t *SecondaryNavigationValue = jResp.stringOf(L"global.header.secondaryNavigation.value");
    const wchar_t *SearchValue = jResp.stringOf(L"global.header.search.value");
    const wchar_t *ScreenValue = jResp.stringOf(L"global.content.screen.value");
    const wchar_t *ContainerValue = jResp.stringOf(L"global.content.container.value");
    const wchar_t *HeaderValue = jResp.stringOf(L"global.content.header.value");
    const wchar_t *BodyValue = jResp.stringOf(L"global.content.body.value");
    const wchar_t *BordersAndDividersColor = jResp.stringOf(L"global.bordersAndDividers.color");
    const wchar_t *HeadingsColor = jResp.stringOf(L"custom.headings.color");
    LinksColor = jResp.stringOf(L"custom.links.color");
    const wchar_t *HoverOrFocusValue = jResp.stringOf(L"custom.menus.hoverOrFocus.value");
    ColorValue = jResp.stringOf(L"custom.menus.color.value");
    BackgroundColorValue = jResp.stringOf(L"custom.header.backgroundColor.value");
    ButtonValue = jResp.stringOf(L"custom.header.button.value");
    PrimaryNavigationValue = jResp.stringOf(L"custom.header.primaryNavigation.value");
    SecondaryNavigationValue = jResp.stringOf(L"custom.header.secondaryNavigation.value");
    SearchValue = jResp.stringOf(L"custom.header.search.value");
    ScreenValue = jResp.stringOf(L"custom.content.screen.value");
    ContainerValue = jResp.stringOf(L"custom.content.container.value");
    HeaderValue = jResp.stringOf(L"custom.content.header.value");
    BodyValue = jResp.stringOf(L"custom.content.body.value");
    BordersAndDividersColor = jResp.stringOf(L"custom.bordersAndDividers.color");
    HeadingsColor = jResp.stringOf(L"theme.headings.color");
    LinksColor = jResp.stringOf(L"theme.links.color");
    HoverOrFocusValue = jResp.stringOf(L"theme.menus.hoverOrFocus.value");
    ColorValue = jResp.stringOf(L"theme.menus.color.value");
    BackgroundColorValue = jResp.stringOf(L"theme.header.backgroundColor.value");
    ButtonValue = jResp.stringOf(L"theme.header.button.value");
    PrimaryNavigationValue = jResp.stringOf(L"theme.header.primaryNavigation.value");
    SecondaryNavigationValue = jResp.stringOf(L"theme.header.secondaryNavigation.value");
    SearchValue = jResp.stringOf(L"theme.header.search.value");
    ScreenValue = jResp.stringOf(L"theme.content.screen.value");
    ContainerValue = jResp.stringOf(L"theme.content.container.value");
    HeaderValue = jResp.stringOf(L"theme.content.header.value");
    BodyValue = jResp.stringOf(L"theme.content.body.value");
    BordersAndDividersColor = jResp.stringOf(L"theme.bordersAndDividers.color");
    }

Curl Command

curl -G -d "spaceKey=%3Cstring%3E"
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/settings/lookandfeel

Postman Collection Item JSON

{
  "name": "Get look and feel settings",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/settings/lookandfeel?spaceKey=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "settings",
        "lookandfeel"
      ],
      "query": [
        {
          "key": "spaceKey",
          "value": "<string>",
          "description": "The key of the space for which the look and feel settings will be\nreturned. If this is not set, only the global look and feel settings\nare returned."
        }
      ]
    },
    "description": "Returns the look and feel settings for the site or a single space. This\nincludes attributes such as the color scheme, padding, and border radius.\n\nThe look and feel settings for a space can be inherited from the global\nlook and feel settings or provided by a theme.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nNone"
  },
  "response": [
    {
      "name": "Returned if the requested look and feel settings are 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/lookandfeel?spaceKey=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "settings",
            "lookandfeel"
          ],
          "query": [
            {
              "key": "spaceKey",
              "value": "<string>"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"selected\": \"global\",\n \"global\": {\n  \"headings\": {\n   \"color\": \"veniam in ex velit\"\n  },\n  \"links\": {\n   \"color\": \"fugiat irure dolor nulla\"\n  },\n  \"menus\": {\n   \"hoverOrFocus\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"color\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"header\": {\n   \"backgroundColor\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"button\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"primaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"secondaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"search\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"content\": {\n   \"screen\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"container\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"header\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"body\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"bordersAndDividers\": {\n   \"color\": \"in\"\n  }\n },\n \"custom\": {\n  \"headings\": {\n   \"color\": \"elit aliquip nulla aliqua\"\n  },\n  \"links\": {\n   \"color\": \"aliquip consequat ut occaecat\"\n  },\n  \"menus\": {\n   \"hoverOrFocus\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"color\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"header\": {\n   \"backgroundColor\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"button\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"primaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"secondaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"search\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"content\": {\n   \"screen\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"container\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"header\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"body\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"bordersAndDividers\": {\n   \"color\": \"ut ut\"\n  }\n },\n \"theme\": {\n  \"headings\": {\n   \"color\": \"l\"\n  },\n  \"links\": {\n   \"color\": \"qui do laborum ut\"\n  },\n  \"menus\": {\n   \"hoverOrFocus\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"color\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"header\": {\n   \"backgroundColor\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"button\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"primaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"secondaryNavigation\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"search\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"content\": {\n   \"screen\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"container\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"header\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   },\n   \"body\": {\n    \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n   }\n  },\n  \"bordersAndDividers\": {\n   \"color\": \"quis dolore\"\n  }\n }\n}"
    },
    {
      "name": "Returned if `spaceKey` is invalid.",
      "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/lookandfeel?spaceKey=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "settings",
            "lookandfeel"
          ],
          "query": [
            {
              "key": "spaceKey",
              "value": "<string>"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if there is no space with the given `spaceKey`.",
      "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/lookandfeel?spaceKey=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "settings",
            "lookandfeel"
          ],
          "query": [
            {
              "key": "spaceKey",
              "value": "<string>"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}