Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Resp
// 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
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Resp = loo_Http.QuickRequest("PUT","https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation/:operationKey/user?key=<string>&userName=<string>&accountId=<string>")
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation/:operationKey/user?key=<string>&userName=<string>&accountId=<string>
Postman Collection Item JSON
{
"name": "Add user to content restriction",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PUT",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction/byOperation/:operationKey/user?key=<string>&userName=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"user"
],
"query": [
{
"key": "key",
"value": "<string>",
"description": "This parameter is no longer available and will be removed from the documentation soon.\nUse `accountId` instead.\nSee the [deprecation notice](/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/) for details."
},
{
"key": "userName",
"value": "<string>",
"description": "This parameter is no longer available and will be removed from the documentation soon.\nUse `accountId` instead.\nSee the [deprecation notice](/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/) for details."
},
{
"key": "accountId",
"value": "<string>",
"description": "(Required) The account ID of the user to add to the content restriction. The accountId uniquely identifies the user across\nall Atlassian products. For example, `384093:32b4d9w0-f6a5-3535-11a3-9c8c88d10192`."
}
],
"variable": [
{
"key": "id",
"value": "<string>",
"type": "string",
"description": "(Required) The ID of the content that the restriction applies to."
},
{
"key": "operationKey",
"value": "<string>",
"type": "string",
"description": "(Required) The operation that the restriction applies to."
}
]
},
"description": "Adds a user to a content restriction. That is, grant read or update\npermission to the user for a piece of content.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to edit the content."
},
"response": [
{
"name": "Returned if the user is added to the content restriction. The response\nbody will be empty.",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction/byOperation/:operationKey/user?key=<string>&userName=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"user"
],
"query": [
{
"key": "key",
"value": "<string>"
},
{
"key": "userName",
"value": "<string>"
},
{
"key": "accountId",
"value": "<string>"
}
],
"variable": [
{
"key": "id"
},
{
"key": "operationKey"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if;\n\n- There is no content with the given ID.\n- The calling user does not have permission to view the content.\n- An invalid operation or group is specified.",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction/byOperation/:operationKey/user?key=<string>&userName=<string>&accountId=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"user"
],
"query": [
{
"key": "key",
"value": "<string>"
},
{
"key": "userName",
"value": "<string>"
},
{
"key": "accountId",
"value": "<string>"
}
],
"variable": [
{
"key": "id"
},
{
"key": "operationKey"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}