cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Calling Zendesk API via nintex WF Web Request - help needed :\

Hey everyone,

I'm having a little difficulty getting a JSON Web Request to behave itself and work as it should.

I'm trying to do a PUT request into an instance of Zendesk to update the Status of a ticket there when a Nintex workflow in SP hits a certain point. Pretty simple stuff...I thought.

I've built the JSON API call according to Zendesk's format and it works perfectly in their API Tester (https://developer.zendesk.com/requests/new) and in Flow, but I cannot for the life of me get it working in Nintex and it's driving me bananas.

The details of my web request in N365 are below. The exact same body, URL and authentication works perfectly via the Zendesk developer test, so it's clearly something I've missed in Nintex! I get back a 422 response code with this error message : 

{"error":"Unprocessable Entity","message":"Server could not parse JSON"}

Can anyone point out what I'm doing wrong? Any and all help greatly appreciated. I don't need any more grey hairs and this is causing more than a few to take root!

0 Kudos
Reply
5 Replies
Workflow Hero

Re: Calling Zendesk API via nintex WF Web Request - help needed :\

Hi Scott,


A real quick thought, if you are formatting JSON in your action, when you want a literal '{' character to appear, you must double it to escape it. The reason is that the Workflow Engine uses the braces to format variables into the string.

so a valid JSON payload will look like:

{{
   "TicketSubject" : {Variable:Subject}
   "Submitter" : {WorkflowContext:Initiator}
   "Details" : {{
                   "Property1 : "Value1"
               }}‍‍‍‍‍‍
}}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

We have an item to look at a better experience for this, however it is complicated as many people are already escaping the quotes in existing actions.

Also: For troubleshooting these sorts of things, I'd recommend using something like https://requestb.in/ to see what data has actually come through, so you can post to a bin there and see what has come out.

Let me know if this helps

Thanks,

Callum

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Calling Zendesk API via nintex WF Web Request - help needed :\

Hey Callum,

Thanks for the quick response!

Doesn't look that helped me out unfortunately. I escaped all of the {s and }s I could see and it's still spitting out the 422 error. GET works fine on all, and PUT works fine for everything bar Nintex, so the structure seems like it's okay and correct, but there's obviously something missing.

Any other tricks up your sleeve that you can think of?

Thanks!
Scott

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Calling Zendesk API via nintex WF Web Request - help needed :\

Hi Scott,

If you can I'd recommend trying setting the endpoint to a requestbin endpoint so you can see what is coming through, seems like something is not quite formed correctly for the API you are calling, but not sure what.

Callum

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Calling Zendesk API via nintex WF Web Request - help needed :\

Hey Callum,

Gave it a shot and it spat out the following. Basically the body is what you'd expect.

You're clearly more cluey than I with JSON, so does anything else in there look out of place?

Thanks!

Scott

https://requestb.in
PUT /10unl6s1
application/json
  47 bytes
31s ago https://requestb.in/10unl6s1?inspect#t3xt2j
From 65.52.116.222, 172.68.142.96
FORM/POST PARAMETERS
None
HEADERS

Content-Type: application/json

Connect-Time: 1

X-Request-Id: d5a4f35a-a886-4386-b56e-8a3f3e1d78aa

Connection: close

Content-Length: 47

Cf-Ipcountry: US

Cf-Connecting-Ip: 65.52.116.222

Cf-Visitor: {"scheme":"https"}

Cf-Ray: 3f5502bc983b6c76-SJC

Accept-Encoding: gzip

Host: requestb.in

Total-Route-Time: 0

Via: 1.1 vegur

RAW BODY
{  "ticket": {    "Status":  "Solved"  }}
0 Kudos
Accept as Solution Reply
Workflow Hero

Re: Calling Zendesk API via nintex WF Web Request - help needed :\

Hi Scott,


I'm afraid I'm not sure in this case, looking at this article on your error it seems it is more an internal logical error with the operation rather than a problem with the JSON (though unprocessable entity makes it sound so).

Introduction - Core API - Zendesk Developer Portal 

Callum

0 Kudos
Accept as Solution Reply