Recovering Suspended Tickets - Excel VBA

asipoy

New Member
Joined
Jan 12, 2012
Messages
9
Hi All,

We have an internal Excel tool that recovers suspended tickets using vba and WinHttp.WinHttpRequest.5.1

Following is the process that we follow:
1. - Read the tickets in the suspended queue (using a winhttp and .json url)
2. - fetch the json data for the suspended ticket (excel vba formula)
3. - grab the "author" details from the above json data (excel vba formula)
(Below is the text from API documentation to add this step:
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.)
4. - recover the suspended ticket and pass on the "author" value as parameter (using a winhttp)
5. - get the recovered ticket number (excel vba formula)

We have successfully recovered 1000+ tickets, however, for less than 1% tickets we are facing the challenge (randomly in between without any pattern).

While recovering the ticket we pass on the author value as parameter and below is the code (step 4):

Code:
HTTPReq.send ({"author":{"id":null,"name":"Postmaster","email":"postmaster@em.ucla.edu"}})

This is done using "PUT" and "/api/v2/suspended_tickets/{id}/recover.json"

We have tried to resolve this for almost a month but in vein.

Q1 - Even though the author value is passed on as parameter why does the requester change to the user who called the API and not to the original requester. (for 1% of the recovered tickets)
Q2 - The API documentation says the the syntax for CURL is:

Code:
curl https://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id}/recover.json \
  -X PUT -v -u {email_address}:{password} -d '{}' -H "Content-Type: application/json"

What is the significance of
\ -X, -v, -u, -d
in the curl statement above?

Following is the Excel VBA code used by us:

Code:
    Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    HTTPReq.Option(4) = 13056
    HTTPReq.SetTimeouts 120000, 120000, 120000, 120000
    HTTPReq.Open "PUT", "https://{mydomain}.zendesk.com/api/v2/suspended_tickets/{suspended ticket id}/recover.json", False
    HTTPReq.SetCredentials {userid}, {password}, 0
    HTTPReq.setRequestHeader "Content-Type", "application/json"
    HTTPReq.send ({"author":{"id":null,"name":"Postmaster","email":"postmaster@domain"}})
    HTTPReq.WaitForResponse -1
    msgbox HTTPReq.responseText

Could you please help me with the above two questions.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top