Chilkat Online Tools

unicodeCpp / Atlassian Confluence Cloud / Remove template

Back to Collection Items

#include <CkHttpW.h>
#include <CkHttpResponseW.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;

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

    CkHttpResponseW *resp = http.QuickRequest(L"DELETE",L"https://your-domain.atlassian.net/wiki/rest/api/template/:contentTemplateId");
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

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

    delete resp;
    wprintf(L"Success.\n");
    }

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/template/:contentTemplateId

Postman Collection Item JSON

{
  "name": "Remove template",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/template/:contentTemplateId",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "template",
        ":contentTemplateId"
      ],
      "variable": [
        {
          "key": "contentTemplateId",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The ID of the template to be deleted."
        }
      ]
    },
    "description": "Deletes a template. This results in different actions depending on the\ntype of template:\n\n- If the template is a content template, it is deleted.\n- If the template is a modified space-level blueprint template, it reverts\nto the template inherited from the global-level blueprint template.\n- If the template is a modified global-level blueprint template, it reverts\nto the default global-level blueprint template.\n\n Note, unmodified blueprint templates cannot be deleted."
  },
  "response": [
    {
      "name": "Returned if the template has been successfully been deleted.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/template/:contentTemplateId",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "template",
            ":contentTemplateId"
          ],
          "variable": [
            {
              "key": "contentTemplateId"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}