Chilkat Online Tools

Xojo / Atlassian Confluence Cloud / Delete content version

Back to Collection Items

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

Dim http As New Chilkat.Http
Dim success As Boolean

// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"

Dim resp As Chilkat.HttpResponse
resp = http.QuickRequest("DELETE","https://your-domain.atlassian.net/wiki/rest/api/content/:id/version/:versionNumber")
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = resp.StatusCode
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode <> 204) Then
    System.DebugLog("Response Header:")
    System.DebugLog(resp.Header)
    System.DebugLog("Response Body:")
    System.DebugLog(resp.BodyStr)
    System.DebugLog("Failed.")

    Return
End If

System.DebugLog("Success.")

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/content/:id/version/:versionNumber

Postman Collection Item JSON

{
  "name": "Delete content version",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/content/:id/version/:versionNumber",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "content",
        ":id",
        "version",
        ":versionNumber"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The ID of the content that the version will be deleted from."
        },
        {
          "key": "versionNumber",
          "value": "<integer>",
          "type": "string",
          "description": "(Required) The number of the version to be deleted. The version number starts\nfrom 1 up to current version."
        }
      ]
    },
    "description": "Delete a historical version. This does not delete the changes made to the\ncontent in that version, rather the changes for the deleted version are\nrolled up into the next version. Note, you cannot delete the current version.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to update the content."
  },
  "response": [
    {
      "name": "Returned if the version is 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/content/:id/version/:versionNumber",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "version",
            ":versionNumber"
          ],
          "variable": [
            {
              "key": "id"
            },
            {
              "key": "versionNumber"
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if;\n\n- The content or version cannot be found.\n- The current version is specified.",
      "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/content/:id/version/:versionNumber",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "version",
            ":versionNumber"
          ],
          "variable": [
            {
              "key": "id"
            },
            {
              "key": "versionNumber"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if the calling user doesn't have permission to edit the\ncontent.",
      "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/content/:id/version/:versionNumber",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "version",
            ":versionNumber"
          ],
          "variable": [
            {
              "key": "id"
            },
            {
              "key": "versionNumber"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}