Group Member APIs
Description for groupmembers module.
End Points
Create a group member
Update a group member's role
Get all group members from a group
Delete a member from a group
Create a group member
Adds the required users to the group as group member.
OAuth Scope : ZohoOne.Groups.CREATE
Arguments
user_id
string
ID of the user.
member_role
integer
Indicates the group member role to which the user is assigned. 0 indicates member, 2 indicates moderator, and 3 indicates follower.
Path Parameters
org_id
string
(Required)
The unique identifier of the org.
group_id
string
(Required)
The unique identifier of the group.
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members")
.post(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members"
type: POST
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "POST",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/groups/987000000654321/members",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("POST", "/one/api/v2/orgs/987000000654321/groups/987000000654321/members", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request POST \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"members": {
"user_id": "2xxxxxxxxxxxxxxxx6",
"member_role": 0
}
}
{
"status_code": 201,
"resource_name": "members",
"message": "... //Successfully completed",
"members": {
"user_id": ".....",
"href": "....."
}
}
{
"status_code": 400,
"error_code": "mandatory_field",
"message": "If user_id is not provided or the members list is empty"
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "Current user does not have the required permission"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
{
"status_code": 405,
"error_code": "unsupported_operation",
"message": "If any inactive users in members list (or) If members list contains externalusers"
}
{
"status_code": 409,
"error_code": "department_member_already_exists",
"message": "An error response will be received if a member or moderator is already part of another department, as they can belong to only one department."
}
Update a group member's role
Updates the given group members with the required roles.
OAuth Scope : ZohoOne.Groups.UPDATE
Arguments
user_id
string
ID of the user.
member_role
integer
Indicates the group member role to which the user is assigned. 0 indicates member, 2 indicates moderator, and 3 indicates follower.
Path Parameters
org_id
string
(Required)
The unique identifier of the org.
group_id
string
(Required)
The unique identifier of the group.
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"field1\":\"value1\",\"field2\":\"value2\"}");
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members")
.put(body)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
parameters_data='{"field1":"value1","field2":"value2"}';
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members"
type: PUT
headers: headers_data
content-type: application/json
parameters: parameters_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "PUT",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/groups/987000000654321/members",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
"content-type": "application/json"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({field1: 'value1', field2: 'value2'}));
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
payload = "{\"field1\":\"value1\",\"field2\":\"value2\"}"
headers = {
'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f",
'content-type': "application/json"
}
conn.request("PUT", "/one/api/v2/orgs/987000000654321/groups/987000000654321/members", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request PUT \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f' \
--header 'content-type: application/json' \
--data '{"field1":"value1","field2":"value2"}'
{
"members": {
"user_id": "2xxxxxxxxxxxxxxxx6",
"member_role": 0
}
}
{
"status_code": 200,
"resource_name": "members",
"message": "... //Successfully completed",
"members": {
"user_id": ".....",
"href": "....."
}
}
{
"status_code": 400,
"error_code": "invalid_user",
"message": "If the given user_id in the URI is not found"
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins only"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
Get all group members from a group
Fetches all the members present in the given group.
OAuth Scope : ZohoOne.Groups.READ
Path Parameters
org_id
string
(Required)
The unique identifier of the org.
group_id
string
(Required)
The unique identifier of the group.
Query Parameters
include
string
includes mentioned resource(s) info in the response
Allowed values:
Allowed values:
pending_users: Includes pending users in the response else confirmed users alone will be returnedOkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members")
.get()
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members"
type: GET
headers: headers_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "GET",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/groups/987000000654321/members",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("GET", "/one/api/v2/orgs/987000000654321/groups/987000000654321/members", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request GET \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"status_code": 200,
"resource_name": "members",
"members": [
{
"created_time": "2024-xx-14T14:57:42.617+0530",
"user_status": 1,
"member_role": 0,
"last_name": "Walker",
"user_type": "confirmed",
"user_id": "2xxxxxxxxxxxxxxxx6",
"primary_email": "haxxxxxxxxxxxxxxxxx.com",
"first_name": "James"
},
{...},
{...}
]
}
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "ACCESS_DENIED",
"message": "You do not have permission to perform this action."
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}
{
"status_code": 405,
"error_code": "unsupported_operation",
"message": "If the current user is an external user"
}
Delete a member from a group
Deletes the required member from the given group.
OAuth Scope : ZohoOne.Groups.DELETE
Path Parameters
org_id
string
(Required)
The unique identifier of the org.
group_id
string
(Required)
The unique identifier of the group.
user_id
string
(Required)
ID of the user.
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members/2xxxxxxxxxxxxxxxx6")
.delete(null)
.addHeader("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f")
.build();
Response response = client.newCall(request).execute();
headers_data = Map();
headers_data.put("Authorization", "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f");
response = invokeUrl
[
url: "https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members/2xxxxxxxxxxxxxxxx6"
type: DELETE
headers: headers_data
connection: <connection_name>
];
info response;
const http = require("https");
const options = {
"method": "DELETE",
"hostname": "zohoapis.com",
"port": null,
"path": "/one/api/v2/orgs/987000000654321/groups/987000000654321/members/2xxxxxxxxxxxxxxxx6",
"headers": {
"Authorization": "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f"
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
import http.client
conn = http.client.HTTPSConnection("zohoapis.com")
headers = { 'Authorization': "Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f" }
conn.request("DELETE", "/one/api/v2/orgs/987000000654321/groups/987000000654321/members/2xxxxxxxxxxxxxxxx6", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
curl --request DELETE \
--url https://zohoapis.com/one/api/v2/orgs/987000000654321/groups/987000000654321/members/2xxxxxxxxxxxxxxxx6 \
--header 'Authorization: Zoho-oauthtoken 1000.41d9xxxxxxxxxxxxxxxxxxxxxxxxc2d1.8fccxxxxxxxxxxxxxxxxxxxxxxxx125f'
{
"status_code": 401,
"error_code": "INVALID_TOKEN",
"message": "Authentication required."
}
{
"status_code": 403,
"error_code": "no_permission",
"message": "API is accessible to admins only"
}
{
"status_code": 404,
"error_code": "RESOURCE_NOT_FOUND",
"message": "The requested resource was not found."
}