Back to Collection Items
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkHttpResponse resp = http.QuickRequest("PUT","https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation/:operationKey/group/:groupName");
if (http.get_LastMethodSuccess() == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, String.valueOf(resp.get_StatusCode()));
Log.i(TAG, resp.bodyStr());
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation/:operationKey/group/:groupName
Postman Collection Item JSON
{
"name": "Add group to content restriction",
"request": {
"auth": {
"type": "oauth2"
},
"method": "PUT",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/content/:id/restriction/byOperation/:operationKey/group/:groupName",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"group",
":groupName"
],
"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."
},
{
"key": "groupName",
"value": "<string>",
"type": "string",
"description": "(Required) The name of the group to add to the content restriction."
}
]
},
"description": "Adds a group to a content restriction. That is, grant read or update\npermission to the group 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 group 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/group/:groupName",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"group",
":groupName"
],
"variable": [
{
"key": "id"
},
{
"key": "operationKey"
},
{
"key": "groupName"
}
]
}
},
"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/group/:groupName",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"content",
":id",
"restriction",
"byOperation",
":operationKey",
"group",
":groupName"
],
"variable": [
{
"key": "id"
},
{
"key": "operationKey"
},
{
"key": "groupName"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}