Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "routeOverrideEnabled": "<boolean>"
// }
loJson = createobject("CkJsonObject")
loJson.UpdateString("routeOverrideEnabled","<boolean>")
// Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loHttp.SetRequestHeader("Content-Type","application/json")
loSbRequestBody = createobject("CkStringBuilder")
loJson.EmitSb(loSbRequestBody)
loResp = loHttp.PTextSb("PUT","https://your-domain.atlassian.net/wiki/rest/api/space/:spaceKey/settings",loSbRequestBody,"utf-8","application/json",.F.,.F.)
if (loHttp.LastMethodSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loJson
release loSbRequestBody
return
endif
loSbResponseBody = createobject("CkStringBuilder")
loResp.GetBodySb(loSbResponseBody)
loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
? "Response Header:"
? loResp.Header
? "Failed."
release loResp
release loHttp
release loJson
release loSbRequestBody
release loSbResponseBody
release loJResp
return
endif
release loResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "routeOverrideEnabled": false,
// "_links": {}
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
llRouteOverrideEnabled = loJResp.BoolOf("routeOverrideEnabled")
release loHttp
release loJson
release loSbRequestBody
release loSbResponseBody
release loJResp
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"routeOverrideEnabled": "<boolean>"
}'
https://your-domain.atlassian.net/wiki/rest/api/space/:spaceKey/settings
Postman Collection Item JSON
{
"name": "Update space settings",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"routeOverrideEnabled\": \"<boolean>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/settings",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"settings"
],
"variable": [
{
"key": "spaceKey",
"value": "<string>",
"type": "string",
"description": "(Required) The key of the space whose settings will be updated."
}
]
},
"description": "Updates the settings for a space. Currently only the\n`routeOverrideEnabled` setting can be updated.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\n'Admin' permission for the space."
},
"response": [
{
"name": "Returned if space settings are updated.",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"routeOverrideEnabled\": \"<boolean>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/settings",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"settings"
],
"variable": [
{
"key": "spaceKey"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"routeOverrideEnabled\": false,\n \"_links\": {}\n}"
},
{
"name": "Returned if the authentication credentials are incorrect or missing\nfrom the request.",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"routeOverrideEnabled\": \"<boolean>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/settings",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"settings"
],
"variable": [
{
"key": "spaceKey"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if;\n\n- There is no space with the given key.\n- The calling user does not have permission to update the space.",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"routeOverrideEnabled\": \"<boolean>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/settings",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"settings"
],
"variable": [
{
"key": "spaceKey"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}