autoit / Support API / List Custom Roles
Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oHttp.BasicAuth = True
$oHttp.Login = "login"
$oHttp.Password = "password"
$oHttp.SetRequestHeader "Accept","application/json"
$oSbResponseBody = ObjCreate("Chilkat.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://example.zendesk.com/api/v2/custom_roles",$oSbResponseBody)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
$oJResp = ObjCreate("Chilkat.JsonObject")
$oJResp.LoadSb($oSbResponseBody)
$oJResp.EmitCompact = False
ConsoleWrite("Response Body:" & @CRLF)
ConsoleWrite($oJResp.Emit() & @CRLF)
Local $iRespStatusCode = $oHttp.LastStatus
ConsoleWrite("Response Status Code = " & $iRespStatusCode & @CRLF)
If ($iRespStatusCode >= 400) Then
ConsoleWrite("Response Header:" & @CRLF)
ConsoleWrite($oHttp.LastHeader & @CRLF)
ConsoleWrite("Failed." & @CRLF)
Exit
EndIf
; Sample JSON response:
; (Sample code for parsing the JSON response is shown below)
; {
; "custom_roles": [
; {
; "name": "<string>",
; "role_type": "<integer>",
; "configuration": {
; "assign_tickets_to_any_group": "<boolean>",
; "chat_access": "<boolean>",
; "end_user_list_access": "<string>",
; "end_user_profile_access": "<string>",
; "explore_access": "<string>",
; "forum_access": "<string>",
; "forum_access_restricted_content": "<boolean>",
; "group_access": "<boolean>",
; "light_agent": "<boolean>",
; "macro_access": "<string>",
; "manage_business_rules": "<boolean>",
; "manage_contextual_workspaces": "<boolean>",
; "manage_dynamic_content": "<boolean>",
; "manage_extensions_and_channels": "<boolean>",
; "manage_facebook": "<boolean>",
; "manage_organization_fields": "<boolean>",
; "manage_ticket_fields": "<boolean>",
; "manage_ticket_forms": "<boolean>",
; "manage_user_fields": "<boolean>",
; "moderate_forums": "<boolean>",
; "organization_editing": "<boolean>",
; "organization_notes_editing": "<boolean>",
; "report_access": "<string>",
; "side_conversation_create": "<boolean>",
; "ticket_access": "<string>",
; "ticket_comment_access": "<string>",
; "ticket_deletion": "<boolean>",
; "ticket_editing": "<boolean>",
; "ticket_merge": "<boolean>",
; "ticket_tag_editing": "<boolean>",
; "twitter_search_access": "<boolean>",
; "user_view_access": "<string>",
; "view_access": "<string>",
; "view_deleted_tickets": "<boolean>",
; "voice_access": "<boolean>",
; "voice_dashboard_access": "<boolean>"
; },
; "created_at": "<dateTime>",
; "description": "<string>",
; "id": "<integer>",
; "team_member_count": "<integer>",
; "updated_at": "<dateTime>"
; },
; {
; "name": "<string>",
; "role_type": "<integer>",
; "configuration": {
; "assign_tickets_to_any_group": "<boolean>",
; "chat_access": "<boolean>",
; "end_user_list_access": "<string>",
; "end_user_profile_access": "<string>",
; "explore_access": "<string>",
; "forum_access": "<string>",
; "forum_access_restricted_content": "<boolean>",
; "group_access": "<boolean>",
; "light_agent": "<boolean>",
; "macro_access": "<string>",
; "manage_business_rules": "<boolean>",
; "manage_contextual_workspaces": "<boolean>",
; "manage_dynamic_content": "<boolean>",
; "manage_extensions_and_channels": "<boolean>",
; "manage_facebook": "<boolean>",
; "manage_organization_fields": "<boolean>",
; "manage_ticket_fields": "<boolean>",
; "manage_ticket_forms": "<boolean>",
; "manage_user_fields": "<boolean>",
; "moderate_forums": "<boolean>",
; "organization_editing": "<boolean>",
; "organization_notes_editing": "<boolean>",
; "report_access": "<string>",
; "side_conversation_create": "<boolean>",
; "ticket_access": "<string>",
; "ticket_comment_access": "<string>",
; "ticket_deletion": "<boolean>",
; "ticket_editing": "<boolean>",
; "ticket_merge": "<boolean>",
; "ticket_tag_editing": "<boolean>",
; "twitter_search_access": "<boolean>",
; "user_view_access": "<string>",
; "view_access": "<string>",
; "view_deleted_tickets": "<boolean>",
; "voice_access": "<boolean>",
; "voice_dashboard_access": "<boolean>"
; },
; "created_at": "<dateTime>",
; "description": "<string>",
; "id": "<integer>",
; "team_member_count": "<integer>",
; "updated_at": "<dateTime>"
; }
; ]
; }
; Sample code for parsing the JSON response...
; Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Local $sName
Local $sRole_type
Local $sAssign_tickets_to_any_group
Local $sChat_access
Local $sEnd_user_list_access
Local $sEnd_user_profile_access
Local $sExplore_access
Local $sForum_access
Local $sForum_access_restricted_content
Local $sGroup_access
Local $sLight_agent
Local $sMacro_access
Local $sManage_business_rules
Local $sManage_contextual_workspaces
Local $sManage_dynamic_content
Local $sManage_extensions_and_channels
Local $sManage_facebook
Local $sManage_organization_fields
Local $sManage_ticket_fields
Local $sManage_ticket_forms
Local $sManage_user_fields
Local $sModerate_forums
Local $sOrganization_editing
Local $sOrganization_notes_editing
Local $sReport_access
Local $sSide_conversation_create
Local $sTicket_access
Local $sTicket_comment_access
Local $sTicket_deletion
Local $sTicket_editing
Local $sTicket_merge
Local $sTicket_tag_editing
Local $sTwitter_search_access
Local $sUser_view_access
Local $sView_access
Local $sView_deleted_tickets
Local $sVoice_access
Local $sVoice_dashboard_access
Local $sCreated_at
Local $sDescription
Local $sId
Local $sTeam_member_count
Local $sUpdated_at
Local $i = 0
Local $iCount_i = $oJResp.SizeOfArray("custom_roles")
While $i < $iCount_i
$oJResp.I = $i
$sName = $oJResp.StringOf("custom_roles[i].name")
$sRole_type = $oJResp.StringOf("custom_roles[i].role_type")
$sAssign_tickets_to_any_group = $oJResp.StringOf("custom_roles[i].configuration.assign_tickets_to_any_group")
$sChat_access = $oJResp.StringOf("custom_roles[i].configuration.chat_access")
$sEnd_user_list_access = $oJResp.StringOf("custom_roles[i].configuration.end_user_list_access")
$sEnd_user_profile_access = $oJResp.StringOf("custom_roles[i].configuration.end_user_profile_access")
$sExplore_access = $oJResp.StringOf("custom_roles[i].configuration.explore_access")
$sForum_access = $oJResp.StringOf("custom_roles[i].configuration.forum_access")
$sForum_access_restricted_content = $oJResp.StringOf("custom_roles[i].configuration.forum_access_restricted_content")
$sGroup_access = $oJResp.StringOf("custom_roles[i].configuration.group_access")
$sLight_agent = $oJResp.StringOf("custom_roles[i].configuration.light_agent")
$sMacro_access = $oJResp.StringOf("custom_roles[i].configuration.macro_access")
$sManage_business_rules = $oJResp.StringOf("custom_roles[i].configuration.manage_business_rules")
$sManage_contextual_workspaces = $oJResp.StringOf("custom_roles[i].configuration.manage_contextual_workspaces")
$sManage_dynamic_content = $oJResp.StringOf("custom_roles[i].configuration.manage_dynamic_content")
$sManage_extensions_and_channels = $oJResp.StringOf("custom_roles[i].configuration.manage_extensions_and_channels")
$sManage_facebook = $oJResp.StringOf("custom_roles[i].configuration.manage_facebook")
$sManage_organization_fields = $oJResp.StringOf("custom_roles[i].configuration.manage_organization_fields")
$sManage_ticket_fields = $oJResp.StringOf("custom_roles[i].configuration.manage_ticket_fields")
$sManage_ticket_forms = $oJResp.StringOf("custom_roles[i].configuration.manage_ticket_forms")
$sManage_user_fields = $oJResp.StringOf("custom_roles[i].configuration.manage_user_fields")
$sModerate_forums = $oJResp.StringOf("custom_roles[i].configuration.moderate_forums")
$sOrganization_editing = $oJResp.StringOf("custom_roles[i].configuration.organization_editing")
$sOrganization_notes_editing = $oJResp.StringOf("custom_roles[i].configuration.organization_notes_editing")
$sReport_access = $oJResp.StringOf("custom_roles[i].configuration.report_access")
$sSide_conversation_create = $oJResp.StringOf("custom_roles[i].configuration.side_conversation_create")
$sTicket_access = $oJResp.StringOf("custom_roles[i].configuration.ticket_access")
$sTicket_comment_access = $oJResp.StringOf("custom_roles[i].configuration.ticket_comment_access")
$sTicket_deletion = $oJResp.StringOf("custom_roles[i].configuration.ticket_deletion")
$sTicket_editing = $oJResp.StringOf("custom_roles[i].configuration.ticket_editing")
$sTicket_merge = $oJResp.StringOf("custom_roles[i].configuration.ticket_merge")
$sTicket_tag_editing = $oJResp.StringOf("custom_roles[i].configuration.ticket_tag_editing")
$sTwitter_search_access = $oJResp.StringOf("custom_roles[i].configuration.twitter_search_access")
$sUser_view_access = $oJResp.StringOf("custom_roles[i].configuration.user_view_access")
$sView_access = $oJResp.StringOf("custom_roles[i].configuration.view_access")
$sView_deleted_tickets = $oJResp.StringOf("custom_roles[i].configuration.view_deleted_tickets")
$sVoice_access = $oJResp.StringOf("custom_roles[i].configuration.voice_access")
$sVoice_dashboard_access = $oJResp.StringOf("custom_roles[i].configuration.voice_dashboard_access")
$sCreated_at = $oJResp.StringOf("custom_roles[i].created_at")
$sDescription = $oJResp.StringOf("custom_roles[i].description")
$sId = $oJResp.StringOf("custom_roles[i].id")
$sTeam_member_count = $oJResp.StringOf("custom_roles[i].team_member_count")
$sUpdated_at = $oJResp.StringOf("custom_roles[i].updated_at")
$i = $i + 1
Wend
Curl Command
curl -u login:password -X GET
-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_roles
Postman Collection Item JSON
{
"name": "List Custom Roles",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_roles",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_roles"
]
},
"description": "#### Availability\n\n* Accounts on the Enterprise plan or above\n\n#### Allowed For\n\n* Agents\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_roles",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_roles"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"custom_roles\": [\n {\n \"name\": \"<string>\",\n \"role_type\": \"<integer>\",\n \"configuration\": {\n \"assign_tickets_to_any_group\": \"<boolean>\",\n \"chat_access\": \"<boolean>\",\n \"end_user_list_access\": \"<string>\",\n \"end_user_profile_access\": \"<string>\",\n \"explore_access\": \"<string>\",\n \"forum_access\": \"<string>\",\n \"forum_access_restricted_content\": \"<boolean>\",\n \"group_access\": \"<boolean>\",\n \"light_agent\": \"<boolean>\",\n \"macro_access\": \"<string>\",\n \"manage_business_rules\": \"<boolean>\",\n \"manage_contextual_workspaces\": \"<boolean>\",\n \"manage_dynamic_content\": \"<boolean>\",\n \"manage_extensions_and_channels\": \"<boolean>\",\n \"manage_facebook\": \"<boolean>\",\n \"manage_organization_fields\": \"<boolean>\",\n \"manage_ticket_fields\": \"<boolean>\",\n \"manage_ticket_forms\": \"<boolean>\",\n \"manage_user_fields\": \"<boolean>\",\n \"moderate_forums\": \"<boolean>\",\n \"organization_editing\": \"<boolean>\",\n \"organization_notes_editing\": \"<boolean>\",\n \"report_access\": \"<string>\",\n \"side_conversation_create\": \"<boolean>\",\n \"ticket_access\": \"<string>\",\n \"ticket_comment_access\": \"<string>\",\n \"ticket_deletion\": \"<boolean>\",\n \"ticket_editing\": \"<boolean>\",\n \"ticket_merge\": \"<boolean>\",\n \"ticket_tag_editing\": \"<boolean>\",\n \"twitter_search_access\": \"<boolean>\",\n \"user_view_access\": \"<string>\",\n \"view_access\": \"<string>\",\n \"view_deleted_tickets\": \"<boolean>\",\n \"voice_access\": \"<boolean>\",\n \"voice_dashboard_access\": \"<boolean>\"\n },\n \"created_at\": \"<dateTime>\",\n \"description\": \"<string>\",\n \"id\": \"<integer>\",\n \"team_member_count\": \"<integer>\",\n \"updated_at\": \"<dateTime>\"\n },\n {\n \"name\": \"<string>\",\n \"role_type\": \"<integer>\",\n \"configuration\": {\n \"assign_tickets_to_any_group\": \"<boolean>\",\n \"chat_access\": \"<boolean>\",\n \"end_user_list_access\": \"<string>\",\n \"end_user_profile_access\": \"<string>\",\n \"explore_access\": \"<string>\",\n \"forum_access\": \"<string>\",\n \"forum_access_restricted_content\": \"<boolean>\",\n \"group_access\": \"<boolean>\",\n \"light_agent\": \"<boolean>\",\n \"macro_access\": \"<string>\",\n \"manage_business_rules\": \"<boolean>\",\n \"manage_contextual_workspaces\": \"<boolean>\",\n \"manage_dynamic_content\": \"<boolean>\",\n \"manage_extensions_and_channels\": \"<boolean>\",\n \"manage_facebook\": \"<boolean>\",\n \"manage_organization_fields\": \"<boolean>\",\n \"manage_ticket_fields\": \"<boolean>\",\n \"manage_ticket_forms\": \"<boolean>\",\n \"manage_user_fields\": \"<boolean>\",\n \"moderate_forums\": \"<boolean>\",\n \"organization_editing\": \"<boolean>\",\n \"organization_notes_editing\": \"<boolean>\",\n \"report_access\": \"<string>\",\n \"side_conversation_create\": \"<boolean>\",\n \"ticket_access\": \"<string>\",\n \"ticket_comment_access\": \"<string>\",\n \"ticket_deletion\": \"<boolean>\",\n \"ticket_editing\": \"<boolean>\",\n \"ticket_merge\": \"<boolean>\",\n \"ticket_tag_editing\": \"<boolean>\",\n \"twitter_search_access\": \"<boolean>\",\n \"user_view_access\": \"<string>\",\n \"view_access\": \"<string>\",\n \"view_deleted_tickets\": \"<boolean>\",\n \"voice_access\": \"<boolean>\",\n \"voice_dashboard_access\": \"<boolean>\"\n },\n \"created_at\": \"<dateTime>\",\n \"description\": \"<string>\",\n \"id\": \"<integer>\",\n \"team_member_count\": \"<integer>\",\n \"updated_at\": \"<dateTime>\"\n }\n ]\n}"
}
]
}