DataFlex / Support API / List Custom Roles
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sName
String sRole_type
String sAssign_tickets_to_any_group
String sChat_access
String sEnd_user_list_access
String sEnd_user_profile_access
String sExplore_access
String sForum_access
String sForum_access_restricted_content
String sGroup_access
String sLight_agent
String sMacro_access
String sManage_business_rules
String sManage_contextual_workspaces
String sManage_dynamic_content
String sManage_extensions_and_channels
String sManage_facebook
String sManage_organization_fields
String sManage_ticket_fields
String sManage_ticket_forms
String sManage_user_fields
String sModerate_forums
String sOrganization_editing
String sOrganization_notes_editing
String sReport_access
String sSide_conversation_create
String sTicket_access
String sTicket_comment_access
String sTicket_deletion
String sTicket_editing
String sTicket_merge
String sTicket_tag_editing
String sTwitter_search_access
String sUser_view_access
String sView_access
String sView_deleted_tickets
String sVoice_access
String sVoice_dashboard_access
String sCreated_at
String sDescription
String sId
String sTeam_member_count
String sUpdated_at
Integer i
Integer iCount_i
String sTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Set ComBasicAuth Of hoHttp To True
Set ComLogin Of hoHttp To "login"
Set ComPassword Of hoHttp To "password"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComQuickGetSb Of hoHttp "https://example.zendesk.com/api/v2/custom_roles" vSbResponseBody To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComLastStatus Of hoHttp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComLastHeader Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed."
Procedure_Return
End
// 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
Move 0 To i
Get ComSizeOfArray Of hoJResp "custom_roles" To iCount_i
While (i < iCount_i)
Set ComI Of hoJResp To i
Get ComStringOf Of hoJResp "custom_roles[i].name" To sName
Get ComStringOf Of hoJResp "custom_roles[i].role_type" To sRole_type
Get ComStringOf Of hoJResp "custom_roles[i].configuration.assign_tickets_to_any_group" To sAssign_tickets_to_any_group
Get ComStringOf Of hoJResp "custom_roles[i].configuration.chat_access" To sChat_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.end_user_list_access" To sEnd_user_list_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.end_user_profile_access" To sEnd_user_profile_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.explore_access" To sExplore_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.forum_access" To sForum_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.forum_access_restricted_content" To sForum_access_restricted_content
Get ComStringOf Of hoJResp "custom_roles[i].configuration.group_access" To sGroup_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.light_agent" To sLight_agent
Get ComStringOf Of hoJResp "custom_roles[i].configuration.macro_access" To sMacro_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_business_rules" To sManage_business_rules
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_contextual_workspaces" To sManage_contextual_workspaces
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_dynamic_content" To sManage_dynamic_content
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_extensions_and_channels" To sManage_extensions_and_channels
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_facebook" To sManage_facebook
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_organization_fields" To sManage_organization_fields
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_ticket_fields" To sManage_ticket_fields
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_ticket_forms" To sManage_ticket_forms
Get ComStringOf Of hoJResp "custom_roles[i].configuration.manage_user_fields" To sManage_user_fields
Get ComStringOf Of hoJResp "custom_roles[i].configuration.moderate_forums" To sModerate_forums
Get ComStringOf Of hoJResp "custom_roles[i].configuration.organization_editing" To sOrganization_editing
Get ComStringOf Of hoJResp "custom_roles[i].configuration.organization_notes_editing" To sOrganization_notes_editing
Get ComStringOf Of hoJResp "custom_roles[i].configuration.report_access" To sReport_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.side_conversation_create" To sSide_conversation_create
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_access" To sTicket_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_comment_access" To sTicket_comment_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_deletion" To sTicket_deletion
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_editing" To sTicket_editing
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_merge" To sTicket_merge
Get ComStringOf Of hoJResp "custom_roles[i].configuration.ticket_tag_editing" To sTicket_tag_editing
Get ComStringOf Of hoJResp "custom_roles[i].configuration.twitter_search_access" To sTwitter_search_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.user_view_access" To sUser_view_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.view_access" To sView_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.view_deleted_tickets" To sView_deleted_tickets
Get ComStringOf Of hoJResp "custom_roles[i].configuration.voice_access" To sVoice_access
Get ComStringOf Of hoJResp "custom_roles[i].configuration.voice_dashboard_access" To sVoice_dashboard_access
Get ComStringOf Of hoJResp "custom_roles[i].created_at" To sCreated_at
Get ComStringOf Of hoJResp "custom_roles[i].description" To sDescription
Get ComStringOf Of hoJResp "custom_roles[i].id" To sId
Get ComStringOf Of hoJResp "custom_roles[i].team_member_count" To sTeam_member_count
Get ComStringOf Of hoJResp "custom_roles[i].updated_at" To sUpdated_at
Move (i + 1) To i
Loop
End_Procedure
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}"
}
]
}