API update responses (when a ticket is created) with a standalone workflow - bringing surveyID
There is a way to have a standalone workflow to update responses when a ticket is created (I don’t want to configure several workflows). I can do it easily when I manually input the survey ID.
I’m bringing the survey ID as ticket data, and I also tried to create an API to fetch that information, but it doesn’t work.
Page 1 / 1
Hi,
Your piped in survey ID should probably be wrapped in quotes
"~{ch://OCAC...}"
Thanks. When I test the ticket, it works, but when I run it, it shows these errors.
Thanks. When I test the ticket, it works, but when I run it, it shows these errors.
@Susana_Branco Check the Input JSON to see if it’s getting the right ID from that first API. With the test, you decide the value so it just to confirm the API worked. It doesn’t mean that you get the right value when it’s running automatically
You only need 2 custom path here. 1 is for the survey ID value and 1 is for the response ID value, the rest you can just delete. $.result.ticketData.elementsa2].value
$.result.ticketData.elementsa3].value
Now you can just use the {a} icon to precisely put data from previous task that you have custom path to this one. Remember survey ID it’s a JSON string so it have to be put in “”
{ "surveyId": "{a} in the previous task response ID", "resetRecordedDate": true, "embeddedData": { "property1": "string", "property2": "string" } }
Make sure the method is PUT and change the server yul1 to your server. Find the server in the ID at your account setting
I done what you said:
Just having 2 elements in the first API
Bringing that elements to second API
And still give an error.
You only need 2 custom path here. 1 is for the survey ID value and 1 is for the response ID value, the rest you can just delete. $.result.ticketData.elements[2].value
$.result.ticketData.elements[3].value
@Susana_Branco Please read carefully, it’s custom path to the value, you dont need the key, you need to dig deeper into just the value. An iff there’s error please show us the Input JSON it can help with debugging
Thanks!
What do you mean by 'it’s a custom path to the value, you don’t need the key'? I think I got lost in translation I’m a beginner with APIs."
The Json failed output is
{ "name": "The task is configured incorrectly. Review the task’s configuration then try again.", "message": "{\"meta\":{\"httpStatus\":\"400 - Bad Request\",\"error\":{\"errorMessage\":\"Invalid surveyId parameter. Empty string values are not allowed.\",\"errorCode\":\"JRP_2.3\"},\"requestId\":\"66000a23-8813-4857-a8e4-4635d0354f56\"}}", "needRetry": false}
@Susana_Branco In this piped text, you’re taking the whole JSON object i.e:{ "key": "SurveyID", "value": "SV_agUQBVnQcGsoO7I" }
So add custompath and paste these in, to get only the value in the Ticket API
$.result.ticketData.elementse2].value
$.result.ticketData.elementse3].value
Try the above one first, and piped the data in again and run - because somehow your Response Update API body is not taking the surveyID hence the error message.
If the problem still persit, you need to try switch to using key-value pair type
Key
Value
surveyId
{a}_in_the_value
resetRecordedDate
true
embeddedData.Posresolucao
sim
Try it and let me know
Thanks, I edit it.
@Susana_Branco After this post you can reset it anyway
JSON OUTPUT:{ "name": "The task is configured incorrectly. Review the task’s configuration then try again.", "message": "{\"meta\":{\"httpStatus\":\"400 - Bad Request\",\"error\":{\"errorMessage\":\"Invalid surveyId parameter. Empty string values are not allowed.\",\"errorCode\":\"JRP_2.3\"},\"requestId\":\"4fed3ceb-c692-44e0-8b44-e364246d1a3a\"}}", "needRetry": false}
In the end I will change my token.
@Susana_Branco Hold on, did the success previous API getting the SurveyID in the TicketData in it’s return JSON? Because SurveyID kept comming back empty and I’ve only seen the Ticket Data API run in test. Check back the JSON of TicketData API
It works bringing the “$.result.sourceId” from the 1st task