Chilkat Online Tools

PowerBuilder / Support API / List Custom Roles

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Name
string ls_Role_type
string ls_Assign_tickets_to_any_group
string ls_Chat_access
string ls_End_user_list_access
string ls_End_user_profile_access
string ls_Explore_access
string ls_Forum_access
string ls_Forum_access_restricted_content
string ls_Group_access
string ls_Light_agent
string ls_Macro_access
string ls_Manage_business_rules
string ls_Manage_contextual_workspaces
string ls_Manage_dynamic_content
string ls_Manage_extensions_and_channels
string ls_Manage_facebook
string ls_Manage_organization_fields
string ls_Manage_ticket_fields
string ls_Manage_ticket_forms
string ls_Manage_user_fields
string ls_Moderate_forums
string ls_Organization_editing
string ls_Organization_notes_editing
string ls_Report_access
string ls_Side_conversation_create
string ls_Ticket_access
string ls_Ticket_comment_access
string ls_Ticket_deletion
string ls_Ticket_editing
string ls_Ticket_merge
string ls_Ticket_tag_editing
string ls_Twitter_search_access
string ls_User_view_access
string ls_View_access
string ls_View_deleted_tickets
string ls_Voice_access
string ls_Voice_dashboard_access
string ls_Created_at
string ls_Description
string ls_Id
string ls_Team_member_count
string ls_Updated_at
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"

loo_Http.SetRequestHeader("Accept","application/json")

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/custom_roles",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

// 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

i = 0
li_Count_i = loo_JResp.SizeOfArray("custom_roles")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Name = loo_JResp.StringOf("custom_roles[i].name")
    ls_Role_type = loo_JResp.StringOf("custom_roles[i].role_type")
    ls_Assign_tickets_to_any_group = loo_JResp.StringOf("custom_roles[i].configuration.assign_tickets_to_any_group")
    ls_Chat_access = loo_JResp.StringOf("custom_roles[i].configuration.chat_access")
    ls_End_user_list_access = loo_JResp.StringOf("custom_roles[i].configuration.end_user_list_access")
    ls_End_user_profile_access = loo_JResp.StringOf("custom_roles[i].configuration.end_user_profile_access")
    ls_Explore_access = loo_JResp.StringOf("custom_roles[i].configuration.explore_access")
    ls_Forum_access = loo_JResp.StringOf("custom_roles[i].configuration.forum_access")
    ls_Forum_access_restricted_content = loo_JResp.StringOf("custom_roles[i].configuration.forum_access_restricted_content")
    ls_Group_access = loo_JResp.StringOf("custom_roles[i].configuration.group_access")
    ls_Light_agent = loo_JResp.StringOf("custom_roles[i].configuration.light_agent")
    ls_Macro_access = loo_JResp.StringOf("custom_roles[i].configuration.macro_access")
    ls_Manage_business_rules = loo_JResp.StringOf("custom_roles[i].configuration.manage_business_rules")
    ls_Manage_contextual_workspaces = loo_JResp.StringOf("custom_roles[i].configuration.manage_contextual_workspaces")
    ls_Manage_dynamic_content = loo_JResp.StringOf("custom_roles[i].configuration.manage_dynamic_content")
    ls_Manage_extensions_and_channels = loo_JResp.StringOf("custom_roles[i].configuration.manage_extensions_and_channels")
    ls_Manage_facebook = loo_JResp.StringOf("custom_roles[i].configuration.manage_facebook")
    ls_Manage_organization_fields = loo_JResp.StringOf("custom_roles[i].configuration.manage_organization_fields")
    ls_Manage_ticket_fields = loo_JResp.StringOf("custom_roles[i].configuration.manage_ticket_fields")
    ls_Manage_ticket_forms = loo_JResp.StringOf("custom_roles[i].configuration.manage_ticket_forms")
    ls_Manage_user_fields = loo_JResp.StringOf("custom_roles[i].configuration.manage_user_fields")
    ls_Moderate_forums = loo_JResp.StringOf("custom_roles[i].configuration.moderate_forums")
    ls_Organization_editing = loo_JResp.StringOf("custom_roles[i].configuration.organization_editing")
    ls_Organization_notes_editing = loo_JResp.StringOf("custom_roles[i].configuration.organization_notes_editing")
    ls_Report_access = loo_JResp.StringOf("custom_roles[i].configuration.report_access")
    ls_Side_conversation_create = loo_JResp.StringOf("custom_roles[i].configuration.side_conversation_create")
    ls_Ticket_access = loo_JResp.StringOf("custom_roles[i].configuration.ticket_access")
    ls_Ticket_comment_access = loo_JResp.StringOf("custom_roles[i].configuration.ticket_comment_access")
    ls_Ticket_deletion = loo_JResp.StringOf("custom_roles[i].configuration.ticket_deletion")
    ls_Ticket_editing = loo_JResp.StringOf("custom_roles[i].configuration.ticket_editing")
    ls_Ticket_merge = loo_JResp.StringOf("custom_roles[i].configuration.ticket_merge")
    ls_Ticket_tag_editing = loo_JResp.StringOf("custom_roles[i].configuration.ticket_tag_editing")
    ls_Twitter_search_access = loo_JResp.StringOf("custom_roles[i].configuration.twitter_search_access")
    ls_User_view_access = loo_JResp.StringOf("custom_roles[i].configuration.user_view_access")
    ls_View_access = loo_JResp.StringOf("custom_roles[i].configuration.view_access")
    ls_View_deleted_tickets = loo_JResp.StringOf("custom_roles[i].configuration.view_deleted_tickets")
    ls_Voice_access = loo_JResp.StringOf("custom_roles[i].configuration.voice_access")
    ls_Voice_dashboard_access = loo_JResp.StringOf("custom_roles[i].configuration.voice_dashboard_access")
    ls_Created_at = loo_JResp.StringOf("custom_roles[i].created_at")
    ls_Description = loo_JResp.StringOf("custom_roles[i].description")
    ls_Id = loo_JResp.StringOf("custom_roles[i].id")
    ls_Team_member_count = loo_JResp.StringOf("custom_roles[i].team_member_count")
    ls_Updated_at = loo_JResp.StringOf("custom_roles[i].updated_at")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

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}"
    }
  ]
}