Back to Collection Items
<?php
include("chilkat.php");
// Use "chilkat_9_5_0.php" for versions of Chilkat < 10.0.0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new 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>"
// }
$json = new CkJsonObject();
$json->UpdateString('routeOverrideEnabled','<boolean>');
// Adds the "Authorization: Bearer <access_token>" header.
$http->put_AuthToken('<access_token>');
$http->SetRequestHeader('Content-Type','application/json');
$sbRequestBody = new CkStringBuilder();
$json->EmitSb($sbRequestBody);
// resp is a CkHttpResponse
$resp = $http->PTextSb('PUT','https://your-domain.atlassian.net/wiki/rest/api/space/:spaceKey/settings',$sbRequestBody,'utf-8','application/json',false,false);
if ($http->get_LastMethodSuccess() == false) {
print $http->lastErrorText() . "\n";
exit;
}
$sbResponseBody = new CkStringBuilder();
$resp->GetBodySb($sbResponseBody);
$jResp = new CkJsonObject();
$jResp->LoadSb($sbResponseBody);
$jResp->put_EmitCompact(false);
print 'Response Body:' . "\n";
print $jResp->emit() . "\n";
$respStatusCode = $resp->get_StatusCode();
print 'Response Status Code = ' . $respStatusCode . "\n";
if ($respStatusCode >= 400) {
print 'Response Header:' . "\n";
print $resp->header() . "\n";
print 'Failed.' . "\n";
exit;
}
// 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
$routeOverrideEnabled = $jResp->BoolOf('routeOverrideEnabled');
?>
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": ""
}
]
}