Get Contact Roles
When multiple contacts are associated with a deal/opportunity, the contacts' details are stored in the Contact Roles related list.
Purpose
To get the list of contact roles.
Request Details
Request URL
https://www.zohoapis.com/crm/v2/Contacts/roles
To get a specific contact role:
https://www.zohoapis.com/crm/v2/Contacts/roles/{contact_role_id}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.modules.ALL
(or)
scope=ZohoCRM.modules.contacts.{operation_type}
Possible operation types
ALL - Full access to contacts
READ - Read contacts
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v2/Contacts/roles"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copied//Get instance of ContactRolesOperations Class
ContactRolesOperations contactRolesOperations = new ContactRolesOperations();
//Call GetContactRoles method
APIResponse<ResponseHandler> response = contactRolesOperations.GetContactRoles();
Copied//Get instance of ContactRolesOperations Class
let contactRolesOperations = new ContactRolesOperations();
//Call getContactRoles method
let response = await contactRolesOperations.getContactRoles();
Copiedasync function getContactRoles() {
const got = require("got");
let url = 'https://www.zohoapis.com/crm/v2/Contacts/roles'
let headers = {
Authorization : "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
let requestDetails = {
method : "GET",
headers : headers,
throwHttpErrors : false
}
let response = await got(url, requestDetails)
if(response != null) {
console.log(response.statusCode);
console.log(response.body);
}
}
getContactRoles()
async function getContactRole() {
const got = require("got");
let url = 'https://www.zohoapis.com/crm/v2/Contacts/roles/3409643000000026100'
let headers = {
Authorization : "Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
}
let requestDetails = {
method : "GET",
headers : headers,
throwHttpErrors : false
}
let response = await got(url, requestDetails)
if(response != null) {
console.log(response.statusCode);
console.log(response.body);
}
}
getContactRole()
Response JSON keys
- sequence_numberinteger
Represents the position of the contact role in the picklist in CRM UI.
- namestring
Represents the name of the contact role.
- idstring
Represents the unique ID of the contact role.
Possible Errors
- INVALID_URL_PATTERNHTTP 404
Please check if the URL trying to access is a correct one
Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above. - OAUTH_SCOPE_MISMATCHHTTP 401
Unauthorized
Resolution: Client does not have ZohoCRM.modules.contacts.READ scope. Create a new client with valid scope. Refer to scope section above. - NO_PERMISSIONHTTP 403
Permission denied to read records
Resolution: The user does not have permission to read records. Contact your system administrator. - INTERNAL_ERRORHTTP 500
Internal Server Error
Resolution: Unexpected and unhandled exception in Server. Contact support team. - INVALID_REQUEST_METHODHTTP 400
The http request method type is not a valid one
Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to read records
Resolution: The user does not have the permission to read records. Contact your system administrator.
Sample Response
Copied{
"contact_roles": [
{
"sequence_number": 1,
"name": "Purchasing",
"id": "4150868000000006875"
},
{
"sequence_number": 2,
"name": "Engineering Lead",
"id": "4150868000000006879"
},
{
"sequence_number": 3,
"name": "Economic Decision Maker",
"id": "4150868000000006881"
},
{
"sequence_number": 4,
"name": "Product Management",
"id": "4150868000000006883"
}
]
}