Chilkat Online Tools

autoit / Atlassian Confluence Cloud / Remove template

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"

Local $oResp = $oHttp.QuickRequest("DELETE","https://your-domain.atlassian.net/wiki/rest/api/template/:contentTemplateId")
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

Local $iRespStatusCode = $oResp.StatusCode
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode <> 204) Then
    ConsoleWrite("Response Header:" & @CRLF)
    ConsoleWrite($oResp.Header & @CRLF)
    ConsoleWrite("Response Body:" & @CRLF)
    ConsoleWrite($oResp.BodyStr & @CRLF)
    ConsoleWrite("Failed." & @CRLF)

    Exit
EndIf

ConsoleWrite("Success." & @CRLF)

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": ""
    }
  ]
}