I am trying to perform actions on a tool that supports API. I am using Excel VBA ("WinHttp.WinHttpRequest.5.1").
https://{domain}.zendesk.com/api/v2/suspended_tickets/1234567890/recover.json
domain - is the domain name of our company
1234567890 - dummy suspended ticket number
In the help pages of Zendesk, I found the following information.
**Note:** During recovery, the API sets the requester to the authenticated agent who called the API, not the original requester. This prevents the ticket from being re-suspended after recovery. To preserve the original requester, GET the suspended ticket before recovery and grab the author value.
This clearly says that the author would change and I will have to use the GET method to grab the author value. I have successfully grabed the author value from the ticket information (json file). However, I am not aware, how to send PUT request using the following cURL:
curl https://{domain}.zendesk.com/api/v2/suspended_tickets/1234567890/recover.json -X PUT -v -u {[email protected]/token}:{token} -d '{"author": {"id": null, "name": "A customer", "email": "[email protected]"}}' -H "Content-Type: application/json"
domain - is the domain name of our company
1234567890 - dummy suspended ticket number
-----
Breaking the above cURL line so that it is readable
curl https://{domain}.zendesk.com/api/v2/suspended_tickets/1234567890/recover.json
-X PUT -v -u {[email protected]/token}:{token} -d
'{"author": {"id": null, "name": "A customer", "email": "[email protected]"}}'
-H "Content-Type: application/json"
I have used the following code to fetch (GET) information from the json file:
TargetURL = "https://www.mysite.co.uk/app/api/v1/test"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Option(4) = 13056
HTTPReq.Open "PUT", TargetURL, False
HTTPReq.SetCredentials "user", "password", 0
HTTPReq.setRequestHeader "Content-Type", "application/json"
HTTPReq.send ({"author": {"id":null,"name":"FIRSTNAME LASTNAME","email":"[email protected]"}})
MsgBox (HTTPReq.responseText)
Seeking insightful help from professionals and experts.
Regards....
Bookmarks