PowerBuilder / Support API / Update Request
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_StrVal
string ls_Id
string ls_Value
string ls_Subject
string ls_Assignee_id
string ls_Can_be_solved_by_me
string ls_Created_at
string ls_Custom_status_id
string ls_Description
string ls_Due_at
string ls_Followup_source_id
string ls_Group_id
string ls_Id
string ls_Is_public
string ls_Organization_id
string ls_Priority
string ls_Recipient
string ls_Requester_id
string ls_Solved
string ls_Status
string ls_Ticket_form_id
string ls_V_Type
string ls_Updated_at
string ls_V_Url
string ls_Channel
integer li_Est__
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_Resp = loo_Http.QuickRequest("PUT","https://example.zendesk.com/api/v2/requests/:request_id")
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
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_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "request": {
// "subject": "<string>",
// "assignee_id": "<integer>",
// "can_be_solved_by_me": "<boolean>",
// "collaborator_ids": [
// "<integer>",
// "<integer>"
// ],
// "created_at": "<dateTime>",
// "custom_fields": [
// {
// "id": "<integer>",
// "value": "<string>"
// },
// {
// "id": "<integer>",
// "value": "<string>"
// }
// ],
// "custom_status_id": "<integer>",
// "description": "<string>",
// "due_at": "<dateTime>",
// "email_cc_ids": [
// "<integer>",
// "<integer>"
// ],
// "followup_source_id": "<integer>",
// "group_id": "<integer>",
// "id": "<integer>",
// "is_public": "<boolean>",
// "organization_id": "<integer>",
// "priority": "<string>",
// "recipient": "<string>",
// "requester_id": "<integer>",
// "solved": "<boolean>",
// "status": "<string>",
// "ticket_form_id": "<integer>",
// "type": "<string>",
// "updated_at": "<dateTime>",
// "url": "<string>",
// "via": {
// "channel": "<string>",
// "source": {
// "est__": false
// }
// }
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Subject = loo_JResp.StringOf("request.subject")
ls_Assignee_id = loo_JResp.StringOf("request.assignee_id")
ls_Can_be_solved_by_me = loo_JResp.StringOf("request.can_be_solved_by_me")
ls_Created_at = loo_JResp.StringOf("request.created_at")
ls_Custom_status_id = loo_JResp.StringOf("request.custom_status_id")
ls_Description = loo_JResp.StringOf("request.description")
ls_Due_at = loo_JResp.StringOf("request.due_at")
ls_Followup_source_id = loo_JResp.StringOf("request.followup_source_id")
ls_Group_id = loo_JResp.StringOf("request.group_id")
ls_Id = loo_JResp.StringOf("request.id")
ls_Is_public = loo_JResp.StringOf("request.is_public")
ls_Organization_id = loo_JResp.StringOf("request.organization_id")
ls_Priority = loo_JResp.StringOf("request.priority")
ls_Recipient = loo_JResp.StringOf("request.recipient")
ls_Requester_id = loo_JResp.StringOf("request.requester_id")
ls_Solved = loo_JResp.StringOf("request.solved")
ls_Status = loo_JResp.StringOf("request.status")
ls_Ticket_form_id = loo_JResp.StringOf("request.ticket_form_id")
ls_V_Type = loo_JResp.StringOf("request.type")
ls_Updated_at = loo_JResp.StringOf("request.updated_at")
ls_V_Url = loo_JResp.StringOf("request.url")
ls_Channel = loo_JResp.StringOf("request.via.channel")
li_Est__ = loo_JResp.BoolOf("request.via.source.est__")
i = 0
li_Count_i = loo_JResp.SizeOfArray("request.collaborator_ids")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("request.collaborator_ids[i]")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("request.custom_fields")
do while i < li_Count_i
loo_JResp.I = i
ls_Id = loo_JResp.StringOf("request.custom_fields[i].id")
ls_Value = loo_JResp.StringOf("request.custom_fields[i].value")
i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("request.email_cc_ids")
do while i < li_Count_i
loo_JResp.I = i
ls_StrVal = loo_JResp.StringOf("request.email_cc_ids[i]")
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -u login:password -X PUT
-H "Accept: application/json"
https://example.zendesk.com/api/v2/requests/:request_id
Postman Collection Item JSON
{
"name": "Update Request",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/requests/:request_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"requests",
":request_id"
],
"variable": [
{
"key": "request_id",
"value": "<integer>"
}
]
},
"description": "Updates a request with a comment or collaborators (cc's). The end user who created the request can also use it to mark the request as solved. The endpoint can't be used to update other request attributes.\n\n#### Writable properties\nThis endpoint can only update the following properties in the request.\n\n| Name | Type | Required | Description |\n| ------------------------ | ------- | -------- | ---------------------------------------------------- |\n| comment | object | no | Adds a comment to the request. See [Request comments](#request-comments) |\n| solved | boolean | no | Marks the request as solved. Example: `{\"request\": {\"solved\": \"true\"}}` |\n| additional_collaborators | array | no | Adds collaborators to the request. An email notification is sent to them when the ticket is updated. See [Adding collaborators](/documentation/ticketing/managing-tickets/creating-and-managing-requests#adding-collaborators) |\n\n#### Allowed For\n\n* End users\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/requests/:request_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"requests",
":request_id"
],
"variable": [
{
"key": "request_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"request\": {\n \"subject\": \"<string>\",\n \"assignee_id\": \"<integer>\",\n \"can_be_solved_by_me\": \"<boolean>\",\n \"collaborator_ids\": [\n \"<integer>\",\n \"<integer>\"\n ],\n \"created_at\": \"<dateTime>\",\n \"custom_fields\": [\n {\n \"id\": \"<integer>\",\n \"value\": \"<string>\"\n },\n {\n \"id\": \"<integer>\",\n \"value\": \"<string>\"\n }\n ],\n \"custom_status_id\": \"<integer>\",\n \"description\": \"<string>\",\n \"due_at\": \"<dateTime>\",\n \"email_cc_ids\": [\n \"<integer>\",\n \"<integer>\"\n ],\n \"followup_source_id\": \"<integer>\",\n \"group_id\": \"<integer>\",\n \"id\": \"<integer>\",\n \"is_public\": \"<boolean>\",\n \"organization_id\": \"<integer>\",\n \"priority\": \"<string>\",\n \"recipient\": \"<string>\",\n \"requester_id\": \"<integer>\",\n \"solved\": \"<boolean>\",\n \"status\": \"<string>\",\n \"ticket_form_id\": \"<integer>\",\n \"type\": \"<string>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\",\n \"via\": {\n \"channel\": \"<string>\",\n \"source\": {\n \"est__\": false\n }\n }\n }\n}"
}
]
}