Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "value": "<object>"
// }
var json = new chilkat.JsonObject();
json.UpdateString("value","<object>");
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
http.SetRequestHeader("Content-Type","application/json");
// resp: HttpResponse
var resp = http.PostJson3("https://your-domain.atlassian.net/wiki/rest/api/space/:spaceKey/property/:key","application/json",json);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
var sbResponseBody = new chilkat.StringBuilder();
resp.GetBodySb(sbResponseBody);
var jResp = new chilkat.JsonObject();
jResp.LoadSb(sbResponseBody);
jResp.EmitCompact = false;
console.log("Response Body:");
console.log(jResp.Emit());
var respStatusCode = resp.StatusCode;
console.log("Response Status Code = " + respStatusCode);
if (respStatusCode >= 400) {
console.log("Response Header:");
console.log(resp.Header);
console.log("Failed.");
return;
}
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "id": -13429300,
// "key": "ut veniam dolor",
// "value": {},
// "_expandable": {
// "version": "cillum officia ipsum ut",
// "space": "in Lorem consectetur"
// },
// "version": {
// "when": "1951-11-29T18:04:27.736Z",
// "message": "dolore magna nisi incididunt",
// "number": -49820236,
// "minorEdit": true
// },
// "space": {
// "id": -20471082,
// "key": "in pr",
// "name": "culpa dolor si",
// "type": "irure dolor ea aliquip",
// "status": "sed ex",
// "_expandable": {
// "settings": "exercitation ea nisi Lorem",
// "metadata": "elit",
// "operations": "Lorem consequat aliquip",
// "lookAndFeel": "non occaecat nisi dolor",
// "permissions": "pariatur cupidatat dolor sed dolor",
// "icon": "aliquip",
// "description": "in",
// "theme": "qui",
// "history": "et fugiat culpa irure amet",
// "homepage": "commodo ut amet aute sint"
// },
// "_links": {},
// "icon": {
// "path": "laborum velit dolore",
// "width": -4680192,
// "height": 21898365,
// "isDefault": false
// },
// "description": {
// "plain": {
// "value": "sit deserunt",
// "representation": "plain",
// "embeddedContent": [
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// ]
// },
// "view": {
// "value": "commodo dolore do",
// "representation": "plain",
// "embeddedContent": [
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// ]
// }
// },
// "homepage": {
// "value": "<Circular reference to #/components/schemas/Content detected>"
// },
// "metadata": {
// "labels": {
// "results": [
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// ],
// "start": 4373903,
// "limit": -70310049,
// "size": -89717135,
// "_links": {}
// }
// },
// "operations": [
// {
// "operation": "update",
// "targetType": "space"
// },
// {
// "operation": "update",
// "targetType": "attachment"
// }
// ],
// "permissions": [
// {
// "subjects": {
// "_expandable": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "user": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "group": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "operation": {
// "operation": "restore",
// "targetType": "comment"
// },
// "anonymousAccess": false,
// "unlicensedAccess": false
// },
// {
// "subjects": {
// "_expandable": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "user": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "group": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "operation": {
// "operation": "export",
// "targetType": "attachment"
// },
// "anonymousAccess": false,
// "unlicensedAccess": false
// }
// ],
// "settings": {
// "routeOverrideEnabled": false,
// "_links": {}
// },
// "theme": {},
// "lookAndFeel": {
// "headings": {
// "color": "<string>"
// },
// "links": {
// "color": "<string>"
// },
// "menus": {
// "hoverOrFocus": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "color": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "header": {
// "backgroundColor": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "button": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "primaryNavigation": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "secondaryNavigation": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "search": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "content": {
// "screen": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "container": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "header": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "body": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "bordersAndDividers": {
// "color": "<string>"
// }
// },
// "history": {
// "createdDate": "1978-05-15T09:31:11.737Z"
// }
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
var value;
var operation;
var targetType;
var v_expandableValue;
var UserValue;
var GroupValue;
var Operation;
var TargetType;
var anonymousAccess;
var unlicensedAccess;
var id = jResp.IntOf("id");
var key = jResp.StringOf("key");
var Version = jResp.StringOf("_expandable.version");
var Space = jResp.StringOf("_expandable.space");
var When = jResp.StringOf("version.when");
var Message = jResp.StringOf("version.message");
var v_Number = jResp.IntOf("version.number");
var MinorEdit = jResp.BoolOf("version.minorEdit");
var Id = jResp.IntOf("space.id");
var Key = jResp.StringOf("space.key");
var Name = jResp.StringOf("space.name");
var v_Type = jResp.StringOf("space.type");
var Status = jResp.StringOf("space.status");
var Settings = jResp.StringOf("space._expandable.settings");
var Metadata = jResp.StringOf("space._expandable.metadata");
var Operations = jResp.StringOf("space._expandable.operations");
var LookAndFeel = jResp.StringOf("space._expandable.lookAndFeel");
var Permissions = jResp.StringOf("space._expandable.permissions");
var Icon = jResp.StringOf("space._expandable.icon");
var Description = jResp.StringOf("space._expandable.description");
var Theme = jResp.StringOf("space._expandable.theme");
var History = jResp.StringOf("space._expandable.history");
var Homepage = jResp.StringOf("space._expandable.homepage");
var Path = jResp.StringOf("space.icon.path");
var Width = jResp.IntOf("space.icon.width");
var Height = jResp.IntOf("space.icon.height");
var IsDefault = jResp.BoolOf("space.icon.isDefault");
var Value = jResp.StringOf("space.description.plain.value");
var Representation = jResp.StringOf("space.description.plain.representation");
var ViewValue = jResp.StringOf("space.description.view.value");
var ViewRepresentation = jResp.StringOf("space.description.view.representation");
var HomepageValue = jResp.StringOf("space.homepage.value");
var Start = jResp.IntOf("space.metadata.labels.start");
var Limit = jResp.IntOf("space.metadata.labels.limit");
var Size = jResp.IntOf("space.metadata.labels.size");
var RouteOverrideEnabled = jResp.BoolOf("space.settings.routeOverrideEnabled");
var Color = jResp.StringOf("space.lookAndFeel.headings.color");
var LinksColor = jResp.StringOf("space.lookAndFeel.links.color");
var HoverOrFocusValue = jResp.StringOf("space.lookAndFeel.menus.hoverOrFocus.value");
var ColorValue = jResp.StringOf("space.lookAndFeel.menus.color.value");
var BackgroundColorValue = jResp.StringOf("space.lookAndFeel.header.backgroundColor.value");
var ButtonValue = jResp.StringOf("space.lookAndFeel.header.button.value");
var PrimaryNavigationValue = jResp.StringOf("space.lookAndFeel.header.primaryNavigation.value");
var SecondaryNavigationValue = jResp.StringOf("space.lookAndFeel.header.secondaryNavigation.value");
var SearchValue = jResp.StringOf("space.lookAndFeel.header.search.value");
var ScreenValue = jResp.StringOf("space.lookAndFeel.content.screen.value");
var ContainerValue = jResp.StringOf("space.lookAndFeel.content.container.value");
var HeaderValue = jResp.StringOf("space.lookAndFeel.content.header.value");
var BodyValue = jResp.StringOf("space.lookAndFeel.content.body.value");
var BordersAndDividersColor = jResp.StringOf("space.lookAndFeel.bordersAndDividers.color");
var CreatedDate = jResp.StringOf("space.history.createdDate");
var i = 0;
var count_i = jResp.SizeOfArray("space.description.plain.embeddedContent");
while (i < count_i) {
jResp.I = i;
value = jResp.StringOf("space.description.plain.embeddedContent[i].value");
i = i+1;
}
i = 0;
count_i = jResp.SizeOfArray("space.description.view.embeddedContent");
while (i < count_i) {
jResp.I = i;
value = jResp.StringOf("space.description.view.embeddedContent[i].value");
i = i+1;
}
i = 0;
count_i = jResp.SizeOfArray("space.metadata.labels.results");
while (i < count_i) {
jResp.I = i;
value = jResp.StringOf("space.metadata.labels.results[i].value");
i = i+1;
}
i = 0;
count_i = jResp.SizeOfArray("space.operations");
while (i < count_i) {
jResp.I = i;
operation = jResp.StringOf("space.operations[i].operation");
targetType = jResp.StringOf("space.operations[i].targetType");
i = i+1;
}
i = 0;
count_i = jResp.SizeOfArray("space.permissions");
while (i < count_i) {
jResp.I = i;
v_expandableValue = jResp.StringOf("space.permissions[i].subjects._expandable.value");
UserValue = jResp.StringOf("space.permissions[i].subjects.user.value");
GroupValue = jResp.StringOf("space.permissions[i].subjects.group.value");
Operation = jResp.StringOf("space.permissions[i].operation.operation");
TargetType = jResp.StringOf("space.permissions[i].operation.targetType");
anonymousAccess = jResp.BoolOf("space.permissions[i].anonymousAccess");
unlicensedAccess = jResp.BoolOf("space.permissions[i].unlicensedAccess");
i = i+1;
}
}
chilkatExample();
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"value": "<object>"
}'
https://your-domain.atlassian.net/wiki/rest/api/space/:spaceKey/property/:key
Postman Collection Item JSON
{
"name": "Create space property for key",
"request": {
"auth": {
"type": "oauth2"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"value\": \"<object>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/property/:key",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"property",
":key"
],
"variable": [
{
"key": "spaceKey",
"value": "<string>",
"type": "string",
"description": "(Required) The key of the space that the property will be created in."
},
{
"key": "key",
"value": "<string>",
"type": "string",
"description": "(Required) The key of the property to be created."
}
]
},
"description": "Creates a new space property. This is the same as `POST\n/api/space/{spaceKey}/property` but the key for the property is passed as a\npath parameter, rather than in the request body.\n\n**[Permissions required](https://confluence.atlassian.com/x/_AozKw)**:\n‘Admin’ permission for the space."
},
"response": [
{
"name": "Returned if the space property is created.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"value\": \"<object>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/property/:key",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"property",
":key"
],
"variable": [
{
"key": "spaceKey"
},
{
"key": "key"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": -13429300,\n \"key\": \"ut veniam dolor\",\n \"value\": {},\n \"_expandable\": {\n \"version\": \"cillum officia ipsum ut\",\n \"space\": \"in Lorem consectetur\"\n },\n \"version\": {\n \"when\": \"1951-11-29T18:04:27.736Z\",\n \"message\": \"dolore magna nisi incididunt\",\n \"number\": -49820236,\n \"minorEdit\": true\n },\n \"space\": {\n \"id\": -20471082,\n \"key\": \"in pr\",\n \"name\": \"culpa dolor si\",\n \"type\": \"irure dolor ea aliquip\",\n \"status\": \"sed ex\",\n \"_expandable\": {\n \"settings\": \"exercitation ea nisi Lorem\",\n \"metadata\": \"elit\",\n \"operations\": \"Lorem consequat aliquip\",\n \"lookAndFeel\": \"non occaecat nisi dolor\",\n \"permissions\": \"pariatur cupidatat dolor sed dolor\",\n \"icon\": \"aliquip\",\n \"description\": \"in\",\n \"theme\": \"qui\",\n \"history\": \"et fugiat culpa irure amet\",\n \"homepage\": \"commodo ut amet aute sint\"\n },\n \"_links\": {},\n \"icon\": {\n \"path\": \"laborum velit dolore\",\n \"width\": -4680192,\n \"height\": 21898365,\n \"isDefault\": false\n },\n \"description\": {\n \"plain\": {\n \"value\": \"sit deserunt\",\n \"representation\": \"plain\",\n \"embeddedContent\": [\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n ]\n },\n \"view\": {\n \"value\": \"commodo dolore do\",\n \"representation\": \"plain\",\n \"embeddedContent\": [\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n ]\n }\n },\n \"homepage\": {\n \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n },\n \"metadata\": {\n \"labels\": {\n \"results\": [\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n ],\n \"start\": 4373903,\n \"limit\": -70310049,\n \"size\": -89717135,\n \"_links\": {}\n }\n },\n \"operations\": [\n {\n \"operation\": \"update\",\n \"targetType\": \"space\"\n },\n {\n \"operation\": \"update\",\n \"targetType\": \"attachment\"\n }\n ],\n \"permissions\": [\n {\n \"subjects\": {\n \"_expandable\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"user\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"group\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"operation\": {\n \"operation\": \"restore\",\n \"targetType\": \"comment\"\n },\n \"anonymousAccess\": false,\n \"unlicensedAccess\": false\n },\n {\n \"subjects\": {\n \"_expandable\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"user\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"group\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"operation\": {\n \"operation\": \"export\",\n \"targetType\": \"attachment\"\n },\n \"anonymousAccess\": false,\n \"unlicensedAccess\": false\n }\n ],\n \"settings\": {\n \"routeOverrideEnabled\": false,\n \"_links\": {}\n },\n \"theme\": {},\n \"lookAndFeel\": {\n \"headings\": {\n \"color\": \"<string>\"\n },\n \"links\": {\n \"color\": \"<string>\"\n },\n \"menus\": {\n \"hoverOrFocus\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"color\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"header\": {\n \"backgroundColor\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"button\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"primaryNavigation\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"secondaryNavigation\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"search\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"content\": {\n \"screen\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"container\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"header\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"body\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"bordersAndDividers\": {\n \"color\": \"<string>\"\n }\n },\n \"history\": {\n \"createdDate\": \"1978-05-15T09:31:11.737Z\"\n }\n }\n}"
},
{
"name": "Returned if any of the following is true:\n\n- The space already has a value with the given key.\n- No property value was provided.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"value\": \"<object>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/property/:key",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"property",
":key"
],
"variable": [
{
"key": "spaceKey"
},
{
"key": "key"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if the user does not have the 'Admin' permission for the\nspace.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"value\": \"<object>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/property/:key",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"property",
":key"
],
"variable": [
{
"key": "spaceKey"
},
{
"key": "key"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if the value for the property is too long.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"value\": \"<object>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/space/:spaceKey/property/:key",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"space",
":spaceKey",
"property",
":key"
],
"variable": [
{
"key": "spaceKey"
},
{
"key": "key"
}
]
}
},
"status": "Request Entity Too Large",
"code": 413,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}