Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject json;
HCkHttpResponse resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "accountId": "<string>"
// }
json = CkJsonObject_Create();
CkJsonObject_UpdateString(json,"accountId","<string>");
// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,"<access_token>");
CkHttp_SetRequestHeader(http,"Content-Type","application/json");
resp = CkHttp_PostJson3(http,"https://your-domain.atlassian.net/wiki/rest/api/group/user?name=<string>","application/json",json);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
return;
}
printf("%d\n",CkHttpResponse_getStatusCode(resp));
printf("%s\n",CkHttpResponse_bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
}
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-d '{
"accountId": "<string>"
}'
https://your-domain.atlassian.net/wiki/rest/api/group/user?name=<string>
Postman Collection Item JSON
{
"name": "Add member to group",
"request": {
"auth": {
"type": "oauth2"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"accountId\": \"<string>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>",
"description": "(Required) Name of the group whose membership is updated"
}
]
},
"description": "Adds a user as a member in a group.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nUser must be a site admin."
},
"response": [
{
"name": "Returned if the group was created successfully.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>"
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if the name or accountId are missing or invalid.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if the calling user is not logged in to Confluence.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Returned if the user is not a site admin.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "If no user group by the give name exists.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: oauth2",
"type": "text/plain"
},
"key": "Authorization",
"value": "<token>"
}
],
"url": {
"raw": "{{baseUrl}}/api/group/user?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"group",
"user"
],
"query": [
{
"key": "name",
"value": "<string>"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}