SQL Server / Support API / Update Custom Role
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
EXEC sp_OASetProperty @http, 'BasicAuth', 1
EXEC sp_OASetProperty @http, 'Login', 'login'
EXEC sp_OASetProperty @http, 'Password', 'password'
EXEC sp_OAMethod @http, 'SetRequestHeader', NULL, 'Accept', 'application/json'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequest', @resp OUT, 'PUT', 'https://example.zendesk.com/api/v2/custom_roles/:custom_role_id'
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
RETURN
END
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @resp, 'GetBodySb', @success OUT, @sbResponseBody
DECLARE @jResp int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @jResp OUT
EXEC sp_OAMethod @jResp, 'LoadSb', @success OUT, @sbResponseBody
EXEC sp_OASetProperty @jResp, 'EmitCompact', 0
PRINT 'Response Body:'
EXEC sp_OAMethod @jResp, 'Emit', @sTmp0 OUT
PRINT @sTmp0
DECLARE @respStatusCode int
EXEC sp_OAGetProperty @resp, 'StatusCode', @respStatusCode OUT
PRINT 'Response Status Code = ' + @respStatusCode
IF @respStatusCode >= 400
BEGIN
PRINT 'Response Header:'
EXEC sp_OAGetProperty @resp, 'Header', @sTmp0 OUT
PRINT @sTmp0
PRINT 'Failed.'
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
RETURN
END
EXEC @hr = sp_OADestroy @resp
-- 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
DECLARE @Name nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Name OUT, 'custom_role.name'
DECLARE @Role_type nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Role_type OUT, 'custom_role.role_type'
DECLARE @Assign_tickets_to_any_group nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Assign_tickets_to_any_group OUT, 'custom_role.configuration.assign_tickets_to_any_group'
DECLARE @Chat_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Chat_access OUT, 'custom_role.configuration.chat_access'
DECLARE @End_user_list_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @End_user_list_access OUT, 'custom_role.configuration.end_user_list_access'
DECLARE @End_user_profile_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @End_user_profile_access OUT, 'custom_role.configuration.end_user_profile_access'
DECLARE @Explore_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Explore_access OUT, 'custom_role.configuration.explore_access'
DECLARE @Forum_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Forum_access OUT, 'custom_role.configuration.forum_access'
DECLARE @Forum_access_restricted_content nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Forum_access_restricted_content OUT, 'custom_role.configuration.forum_access_restricted_content'
DECLARE @Group_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Group_access OUT, 'custom_role.configuration.group_access'
DECLARE @Light_agent nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Light_agent OUT, 'custom_role.configuration.light_agent'
DECLARE @Macro_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Macro_access OUT, 'custom_role.configuration.macro_access'
DECLARE @Manage_business_rules nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_business_rules OUT, 'custom_role.configuration.manage_business_rules'
DECLARE @Manage_contextual_workspaces nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_contextual_workspaces OUT, 'custom_role.configuration.manage_contextual_workspaces'
DECLARE @Manage_dynamic_content nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_dynamic_content OUT, 'custom_role.configuration.manage_dynamic_content'
DECLARE @Manage_extensions_and_channels nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_extensions_and_channels OUT, 'custom_role.configuration.manage_extensions_and_channels'
DECLARE @Manage_facebook nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_facebook OUT, 'custom_role.configuration.manage_facebook'
DECLARE @Manage_organization_fields nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_organization_fields OUT, 'custom_role.configuration.manage_organization_fields'
DECLARE @Manage_ticket_fields nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_ticket_fields OUT, 'custom_role.configuration.manage_ticket_fields'
DECLARE @Manage_ticket_forms nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_ticket_forms OUT, 'custom_role.configuration.manage_ticket_forms'
DECLARE @Manage_user_fields nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Manage_user_fields OUT, 'custom_role.configuration.manage_user_fields'
DECLARE @Moderate_forums nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Moderate_forums OUT, 'custom_role.configuration.moderate_forums'
DECLARE @Organization_editing nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Organization_editing OUT, 'custom_role.configuration.organization_editing'
DECLARE @Organization_notes_editing nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Organization_notes_editing OUT, 'custom_role.configuration.organization_notes_editing'
DECLARE @Report_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Report_access OUT, 'custom_role.configuration.report_access'
DECLARE @Side_conversation_create nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Side_conversation_create OUT, 'custom_role.configuration.side_conversation_create'
DECLARE @Ticket_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_access OUT, 'custom_role.configuration.ticket_access'
DECLARE @Ticket_comment_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_comment_access OUT, 'custom_role.configuration.ticket_comment_access'
DECLARE @Ticket_deletion nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_deletion OUT, 'custom_role.configuration.ticket_deletion'
DECLARE @Ticket_editing nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_editing OUT, 'custom_role.configuration.ticket_editing'
DECLARE @Ticket_merge nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_merge OUT, 'custom_role.configuration.ticket_merge'
DECLARE @Ticket_tag_editing nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Ticket_tag_editing OUT, 'custom_role.configuration.ticket_tag_editing'
DECLARE @Twitter_search_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Twitter_search_access OUT, 'custom_role.configuration.twitter_search_access'
DECLARE @User_view_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @User_view_access OUT, 'custom_role.configuration.user_view_access'
DECLARE @View_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @View_access OUT, 'custom_role.configuration.view_access'
DECLARE @View_deleted_tickets nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @View_deleted_tickets OUT, 'custom_role.configuration.view_deleted_tickets'
DECLARE @Voice_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Voice_access OUT, 'custom_role.configuration.voice_access'
DECLARE @Voice_dashboard_access nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Voice_dashboard_access OUT, 'custom_role.configuration.voice_dashboard_access'
DECLARE @Created_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Created_at OUT, 'custom_role.created_at'
DECLARE @Description nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Description OUT, 'custom_role.description'
DECLARE @Id nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Id OUT, 'custom_role.id'
DECLARE @Team_member_count nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Team_member_count OUT, 'custom_role.team_member_count'
DECLARE @Updated_at nvarchar(4000)
EXEC sp_OAMethod @jResp, 'StringOf', @Updated_at OUT, 'custom_role.updated_at'
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jResp
END
GO
Curl Command
curl -u login:password -X PUT
-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_roles/:custom_role_id
Postman Collection Item JSON
{
"name": "Update Custom Role",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_roles/:custom_role_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_roles",
":custom_role_id"
],
"variable": [
{
"key": "custom_role_id",
"value": "<integer>"
}
]
},
"description": "#### Availability\n\n* Accounts on the Enterprise plan or above\n\n#### Allowed for\n\n* Administrators\nAgents with the `manage_roles` permission\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_roles/:custom_role_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_roles",
":custom_role_id"
],
"variable": [
{
"key": "custom_role_id"
}
]
}
},
"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}"
}
]
}