Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Jarr
oleobject loo_JsonObj_1
oleobject loo_SbRequestBody
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Operation
string ls_Restrictions
string ls_Content
string ls_Value
string ls_StartValue
string ls_LimitValue
string ls_SizeValue
string ls_ResultsValue
string ls_User
string ls_Group
string ls_ContentValue
integer li_Start
integer li_Limit
integer li_Size
string ls_RestrictionsHash
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// [
// {
// "operation": "<string>",
// "restrictions": {
// "user": [
// {
// "type": "<string>",
// "accountId": "<string>",
// "username": "<string>",
// "userKey": "<string>"
// },
// {
// "type": "<string>",
// "accountId": "<string>",
// "username": "<string>",
// "userKey": "<string>"
// }
// ],
// "group": [
// {
// "type": "<string>",
// "name": "<string>"
// },
// {
// "type": "<string>",
// "name": "<string>"
// }
// ]
// }
// },
// {
// "operation": "<string>",
// "restrictions": {
// "user": [
// {
// "type": "<string>",
// "accountId": "<string>",
// "username": "<string>",
// "userKey": "<string>"
// },
// {
// "type": "<string>",
// "accountId": "<string>",
// "username": "<string>",
// "userKey": "<string>"
// }
// ],
// "group": [
// {
// "type": "<string>",
// "name": "<string>"
// },
// {
// "type": "<string>",
// "name": "<string>"
// }
// ]
// }
// }
// ]
loo_Jarr = create oleobject
// Use "Chilkat_9_5_0.JsonArray" for versions of Chilkat < 10.0.0
li_rc = loo_Jarr.ConnectToNewObject("Chilkat.JsonArray")
loo_Jarr.AddObjectAt(-1)
loo_JsonObj_1 = loo_Jarr.ObjectAt(loo_Jarr.Size - 1)
loo_JsonObj_1.UpdateString("operation","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].accountId","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].username","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].userKey","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].accountId","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].username","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].userKey","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[0].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[0].name","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[1].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[1].name","<string>")
destroy loo_JsonObj_1
loo_Jarr.AddObjectAt(-1)
loo_JsonObj_1 = loo_Jarr.ObjectAt(loo_Jarr.Size - 1)
loo_JsonObj_1.UpdateString("operation","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].accountId","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].username","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[0].userKey","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].accountId","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].username","<string>")
loo_JsonObj_1.UpdateString("restrictions.user[1].userKey","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[0].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[0].name","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[1].type","<string>")
loo_JsonObj_1.UpdateString("restrictions.group[1].name","<string>")
destroy loo_JsonObj_1
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Jarr.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("PUT","https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction?expand=<string>&expand=<string>",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Jarr
destroy loo_SbRequestBody
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_Jarr
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "results": [
// {
// "operation": "purge",
// "_expandable": {
// "restrictions": "Excepteur dolore Ut labore",
// "content": "tempor esse officia"
// },
// "_links": {},
// "restrictions": {
// "user": {
// "results": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "start": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "limit": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "size": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "group": {
// "results": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "start": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "limit": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "size": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "_expandable": {
// "user": "in in mollit Ut occaecat",
// "group": "irure qui consectetur incididunt"
// }
// },
// "content": {
// "value": "<Circular reference to #/components/schemas/Content detected>"
// }
// },
// {
// "operation": "delete",
// "_expandable": {
// "restrictions": "nisi id",
// "content": "ut in mollit enim"
// },
// "_links": {},
// "restrictions": {
// "user": {
// "results": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "start": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "limit": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "size": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "group": {
// "results": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "start": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "limit": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// },
// "size": {
// "value": "<Error: Too many levels of nesting to fake this schema>"
// }
// },
// "_expandable": {
// "user": "est voluptate",
// "group": "in"
// }
// },
// "content": {
// "value": "<Circular reference to #/components/schemas/Content detected>"
// }
// }
// ],
// "start": 17789838,
// "limit": 13313455,
// "size": -47874490,
// "restrictionsHash": "Lorem commodo pariatur Ut eiusmod",
// "_links": {}
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
li_Start = loo_JResp.IntOf("start")
li_Limit = loo_JResp.IntOf("limit")
li_Size = loo_JResp.IntOf("size")
ls_RestrictionsHash = loo_JResp.StringOf("restrictionsHash")
i = 0
li_Count_i = loo_JResp.SizeOfArray("results")
do while i < li_Count_i
loo_JResp.I = i
ls_Operation = loo_JResp.StringOf("results[i].operation")
ls_Restrictions = loo_JResp.StringOf("results[i]._expandable.restrictions")
ls_Content = loo_JResp.StringOf("results[i]._expandable.content")
ls_Value = loo_JResp.StringOf("results[i].restrictions.user.results.value")
ls_StartValue = loo_JResp.StringOf("results[i].restrictions.user.start.value")
ls_LimitValue = loo_JResp.StringOf("results[i].restrictions.user.limit.value")
ls_SizeValue = loo_JResp.StringOf("results[i].restrictions.user.size.value")
ls_ResultsValue = loo_JResp.StringOf("results[i].restrictions.group.results.value")
ls_StartValue = loo_JResp.StringOf("results[i].restrictions.group.start.value")
ls_LimitValue = loo_JResp.StringOf("results[i].restrictions.group.limit.value")
ls_SizeValue = loo_JResp.StringOf("results[i].restrictions.group.size.value")
ls_User = loo_JResp.StringOf("results[i].restrictions._expandable.user")
ls_Group = loo_JResp.StringOf("results[i].restrictions._expandable.group")
ls_ContentValue = loo_JResp.StringOf("results[i].content.value")
i = i + 1
loop
destroy loo_Http
destroy loo_Jarr
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '[
{
"operation": "<string>",
"restrictions": {
"user": [
{
"type": "<string>",
"accountId": "<string>",
"username": "<string>",
"userKey": "<string>"
},
{
"type": "<string>",
"accountId": "<string>",
"username": "<string>",
"userKey": "<string>"
}
],
"group": [
{
"type": "<string>",
"name": "<string>"
},
{
"type": "<string>",
"name": "<string>"
}
]
}
},
{
"operation": "<string>",
"restrictions": {
"user": [
{
"type": "<string>",
"accountId": "<string>",
"username": "<string>",
"userKey": "<string>"
},
{
"type": "<string>",
"accountId": "<string>",
"username": "<string>",
"userKey": "<string>"
}
],
"group": [
{
"type": "<string>",
"name": "<string>"
},
{
"type": "<string>",
"name": "<string>"
}
]
}
}
]'
https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction?expand=<string>&expand=<string>
Postman Collection Item JSON
{
"name": "Update restrictions",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\n {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n },\n {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n }\n]"
},
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction"
],
"query": [
{
"key": "expand",
"value": "<string>",
"description": "A multi-value parameter indicating which properties of the content\nrestrictions (returned in response) to expand.\n\n- `restrictions.user` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `restrictions.group` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `content` returns the piece of content that the restrictions are\napplied to."
},
{
"key": "expand",
"value": "<string>",
"description": "A multi-value parameter indicating which properties of the content\nrestrictions (returned in response) to expand.\n\n- `restrictions.user` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `restrictions.group` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `content` returns the piece of content that the restrictions are\napplied to."
}
],
"variable": [
{
"key": "id",
"value": "<string>",
"type": "string",
"description": "(Required) The ID of the content to update restrictions for."
}
]
},
"description": "Updates restrictions for a piece of content. This removes the existing\nrestrictions and replaces them with the restrictions in the request.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to edit the content."
},
"response": [
{
"name": "Returned if the requested restrictions 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 {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n },\n {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n }\n]"
},
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction"
],
"query": [
{
"key": "expand",
"value": "<string>"
},
{
"key": "expand",
"value": "<string>"
}
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"results\": [\n {\n \"operation\": \"purge\",\n \"_expandable\": {\n \"restrictions\": \"Excepteur dolore Ut labore\",\n \"content\": \"tempor esse officia\"\n },\n \"_links\": {},\n \"restrictions\": {\n \"user\": {\n \"results\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"start\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"limit\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"size\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"group\": {\n \"results\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"start\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"limit\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"size\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"_expandable\": {\n \"user\": \"in in mollit Ut occaecat\",\n \"group\": \"irure qui consectetur incididunt\"\n }\n },\n \"content\": {\n \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n }\n },\n {\n \"operation\": \"delete\",\n \"_expandable\": {\n \"restrictions\": \"nisi id\",\n \"content\": \"ut in mollit enim\"\n },\n \"_links\": {},\n \"restrictions\": {\n \"user\": {\n \"results\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"start\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"limit\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"size\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"group\": {\n \"results\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"start\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"limit\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n },\n \"size\": {\n \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n }\n },\n \"_expandable\": {\n \"user\": \"est voluptate\",\n \"group\": \"in\"\n }\n },\n \"content\": {\n \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n }\n }\n ],\n \"start\": 17789838,\n \"limit\": 13313455,\n \"size\": -47874490,\n \"restrictionsHash\": \"Lorem commodo pariatur Ut eiusmod\",\n \"_links\": {}\n}"
},
{
"name": "Returned if;\n\n- There is no content with the given ID.\n- The calling user does not have permission to update restrictions\nfor the content.",
"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 {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n },\n {\n \"operation\": \"<string>\",\n \"restrictions\": {\n \"user\": [\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"accountId\": \"<string>\",\n \"username\": \"<string>\",\n \"userKey\": \"<string>\"\n }\n ],\n \"group\": [\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n },\n {\n \"type\": \"<string>\",\n \"name\": \"<string>\"\n }\n ]\n }\n }\n]"
},
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction"
],
"query": [
{
"key": "expand",
"value": "<string>"
},
{
"key": "expand",
"value": "<string>"
}
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}