DataFlex / Support API / Create Custom Role
Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vResp
Handle hoResp
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
String sTemp1
Boolean bTemp1
// 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 ComQuickRequest Of hoHttp "POST" "https://example.zendesk.com/api/v2/custom_roles" To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
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 ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "custom_role": {
// "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
Get ComStringOf Of hoJResp "custom_role.name" To sName
Get ComStringOf Of hoJResp "custom_role.role_type" To sRole_type
Get ComStringOf Of hoJResp "custom_role.configuration.assign_tickets_to_any_group" To sAssign_tickets_to_any_group
Get ComStringOf Of hoJResp "custom_role.configuration.chat_access" To sChat_access
Get ComStringOf Of hoJResp "custom_role.configuration.end_user_list_access" To sEnd_user_list_access
Get ComStringOf Of hoJResp "custom_role.configuration.end_user_profile_access" To sEnd_user_profile_access
Get ComStringOf Of hoJResp "custom_role.configuration.explore_access" To sExplore_access
Get ComStringOf Of hoJResp "custom_role.configuration.forum_access" To sForum_access
Get ComStringOf Of hoJResp "custom_role.configuration.forum_access_restricted_content" To sForum_access_restricted_content
Get ComStringOf Of hoJResp "custom_role.configuration.group_access" To sGroup_access
Get ComStringOf Of hoJResp "custom_role.configuration.light_agent" To sLight_agent
Get ComStringOf Of hoJResp "custom_role.configuration.macro_access" To sMacro_access
Get ComStringOf Of hoJResp "custom_role.configuration.manage_business_rules" To sManage_business_rules
Get ComStringOf Of hoJResp "custom_role.configuration.manage_contextual_workspaces" To sManage_contextual_workspaces
Get ComStringOf Of hoJResp "custom_role.configuration.manage_dynamic_content" To sManage_dynamic_content
Get ComStringOf Of hoJResp "custom_role.configuration.manage_extensions_and_channels" To sManage_extensions_and_channels
Get ComStringOf Of hoJResp "custom_role.configuration.manage_facebook" To sManage_facebook
Get ComStringOf Of hoJResp "custom_role.configuration.manage_organization_fields" To sManage_organization_fields
Get ComStringOf Of hoJResp "custom_role.configuration.manage_ticket_fields" To sManage_ticket_fields
Get ComStringOf Of hoJResp "custom_role.configuration.manage_ticket_forms" To sManage_ticket_forms
Get ComStringOf Of hoJResp "custom_role.configuration.manage_user_fields" To sManage_user_fields
Get ComStringOf Of hoJResp "custom_role.configuration.moderate_forums" To sModerate_forums
Get ComStringOf Of hoJResp "custom_role.configuration.organization_editing" To sOrganization_editing
Get ComStringOf Of hoJResp "custom_role.configuration.organization_notes_editing" To sOrganization_notes_editing
Get ComStringOf Of hoJResp "custom_role.configuration.report_access" To sReport_access
Get ComStringOf Of hoJResp "custom_role.configuration.side_conversation_create" To sSide_conversation_create
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_access" To sTicket_access
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_comment_access" To sTicket_comment_access
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_deletion" To sTicket_deletion
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_editing" To sTicket_editing
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_merge" To sTicket_merge
Get ComStringOf Of hoJResp "custom_role.configuration.ticket_tag_editing" To sTicket_tag_editing
Get ComStringOf Of hoJResp "custom_role.configuration.twitter_search_access" To sTwitter_search_access
Get ComStringOf Of hoJResp "custom_role.configuration.user_view_access" To sUser_view_access
Get ComStringOf Of hoJResp "custom_role.configuration.view_access" To sView_access
Get ComStringOf Of hoJResp "custom_role.configuration.view_deleted_tickets" To sView_deleted_tickets
Get ComStringOf Of hoJResp "custom_role.configuration.voice_access" To sVoice_access
Get ComStringOf Of hoJResp "custom_role.configuration.voice_dashboard_access" To sVoice_dashboard_access
Get ComStringOf Of hoJResp "custom_role.created_at" To sCreated_at
Get ComStringOf Of hoJResp "custom_role.description" To sDescription
Get ComStringOf Of hoJResp "custom_role.id" To sId
Get ComStringOf Of hoJResp "custom_role.team_member_count" To sTeam_member_count
Get ComStringOf Of hoJResp "custom_role.updated_at" To sUpdated_at
End_Procedure
Curl Command
curl -u login:password -X POST
-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_roles
Postman Collection Item JSON
{
"name": "Create Custom Role",
"request": {
"method": "POST",
"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* Administrators\n* Agents with the `manage_roles` permission\n"
},
"response": [
{
"name": "Created response",
"originalRequest": {
"method": "POST",
"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_role\": {\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}"
}
]
}