# Dynamic Path to Success and Error fields JSON

**URL:** <https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055>\
**Category:** Integrator.io\
**Tags:** error-handling, json, handlebars\
**Created:** [December 23, 2021, 4:52pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055 "2021-12-23T16:52:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiodias](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@fabiodias](https://connective.celigo.com/u/fabiodias)\
**Post date:** [December 23, 2021, 4:52pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/1 "2021-12-23T16:52:18Z")

</div>

Hello Community!

Can someone help with this path to success field?

I've got the below body response...

{  
"success": true,  
"results": {  
"ABC123": {  
"success": false,  
"message": "The order could not be marked as dispatched because it has a status of \"Dispatched\"",  
"errorcode": "InvalidOrderStatus"  
}  
}  
}

I would expect the path to be..

$.results..success

But this doesn't work and I also tried about 50 different combinations, including trying to include handlebars or using XPath and nothing seems to work.

With handlebars I tried the below, where {{order\_id}} is available on the request side.

results.{{order\_id}}.success

Regardless I cannot find a working path!

Note: "ABC123" is the order id on the request.

Thanks!

---

<div class="post-metadata">

**Author:** ![stephenbrandt](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/stephenbrandt/32/6891_2.png) [@stephenbrandt](https://connective.celigo.com/u/stephenbrandt)\
**Post date:** [December 27, 2021, 12:52am UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/2 "2021-12-27T00:52:50Z")

</div>

@fabiodias, in this forum I'm not able to picture what the value of order\_id is in your flow compared to where you need to access the response success value.

Are you trying to get the value of success, or do you need to provide the path to it?

To check the value, you could try looping through the results array:

```
{{#each results}}{{#if @first}}{{success}}{{/if}}{{/each}}
```

If this isn't a 51st attempt or it takes you down another dead end, I'd try [Office Hours](https://docs.celigo.com/hc/en-us/articles/360045798291) next.

---

<div class="post-metadata">

**Author:** ![fabiodias](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@fabiodias](https://connective.celigo.com/u/fabiodias)\
**Post date:** [December 27, 2021, 4:50pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/3 "2021-12-27T16:50:58Z")

</div>

Hi Stephen Brandt,

I'm trying to setup the correct responses by the system, at the moment even correct responses give an error.

This is where I'm trying to setup the paths.

 ![5301043caa20740200000001-4184d97e057947ddba9aac869bb6fce3.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/0/01c5b13455cb5296daffd79138e3f340eaad1fa3.png)

Unfortunately, without luck thus far.

Thanks,

Fabio Dias

---

<div class="post-metadata">

**Author:** ![stephenbrandt](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/stephenbrandt/32/6891_2.png) [@stephenbrandt](https://connective.celigo.com/u/stephenbrandt)\
**Post date:** [December 28, 2021, 6:22pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/4 "2021-12-28T18:22:46Z")

</div>

@fabiodias, your question is a bit more complex than the handlebars solution, which wouldn't apply here.

First of all, it looks as though you're trying to apply JSONPath expressions, which aren't yet supported in integrator․io. That is, you can't specify something allowed elsewhere, like $.results[0].success.

My next observation is that the correct path for success in this case looks to be simply,

```
success
```

at the root, which is in fact "true" in your sample response.

[REVISED] In the _import_ shown above, you should be able to retrieve the value of {{order\_id}}, depending on its structure in your flow's records. However, that might not be useful if there are zero or more than one records that produced an error.

---

<div class="post-metadata">

**Author:** ![stephenbrandt](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/stephenbrandt/32/6891_2.png) [@stephenbrandt](https://connective.celigo.com/u/stephenbrandt)\
**Post date:** [December 28, 2021, 7:16pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/5 "2021-12-28T19:16:41Z")

</div>

@fabiodias: I also reached out to a solutions consultant, who advises that nonstandard error responses aren't as dynamic as what you're hoping to account for. Check out the following article, if you're comfortable with JavaScript:

- [Use a postSubmit hook to ignore specific errors](https://docs.celigo.com/hc/en-us/articles/360045807112-Use-a-postSubmit-hook-to-ignore-specific-errors)

---

<div class="post-metadata">

**Author:** ![fabiodias](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@fabiodias](https://connective.celigo.com/u/fabiodias)\
**Post date:** [December 29, 2021, 10:07am UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/6 "2021-12-29T10:07:20Z")

</div>

Hi Stephen Brandt,

Thanks for all the help thus far!

The structure of my records as below in the "Build relative URI" function.

 ![5301043caa20740200000001-9aac53e83c244d00b1e779360e3d5471.png](https://us1.discourse-cdn.com/flex001/uploads/celigo/original/2X/4/4af231ab9a514fde05a236c9364421b93b7168d7.png)

Could I reference order\_id somehow? I tried {{order\_id}} and {{record.order\_id}}, unsuccessfully... example below.

Message:   
"Unable to extract paths from response body using path: results.{{record.order\_id}}.success, Response: {\"success\":true,\"results\":{\"ABC123\":{\"success\":false,\"message\":\"The order could not be marked as dispatched because it has a status of \\\"Dispatched\\\"\",\"errorcode\":\"InvalidOrderStatus\"}}}"

The reason why I need the nested success field instead of the root one is because if there is a fulfilment error, it is on the nested success field, not on the root one. The root success is just for the connection success/failure.

It would be great if possible to avoid the postSubmit hook as I tend to find that more unexpected behavior happens and this seems to be a fairly simple thing to do.

Thank you,

Fabio Dias

---

<div class="post-metadata">

**Author:** ![courtneyjordan](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@courtneyjordan](https://connective.celigo.com/u/courtneyjordan)\
**Post date:** [December 29, 2021, 4:22pm UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/7 "2021-12-29T16:22:57Z")

</div>

Hi @fabiodias,

Thanks so much for providing this information. We've entered a support ticket on your behalf so that you can get this problem resolved quickly.

---

<div class="post-metadata">

**Author:** ![milchodimkov](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@milchodimkov](https://connective.celigo.com/u/milchodimkov)\
**Post date:** [September 27, 2022, 8:57am UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/8 "2022-09-27T08:57:42Z")

</div>

Hi All,

Has this been resolved?   
I have the same problem -- Celigo raises

```
Unable to extract paths from response body using path...
```

although I just need to access a simple field called "Status" in the root.

Also, looking at the last response above - it looks like Celigo doesn't recognize the response as a valid JSON, which is also my case.

Thanks

---

<div class="post-metadata">

**Author:** ![anithaabraham](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/anithaabraham/32/6964_2.png) [@anithaabraham](https://connective.celigo.com/u/anithaabraham)\
**Post date:** [October 7, 2022, 7:42am UTC](https://connective.celigo.com/t/dynamic-path-to-success-and-error-fields-json/1055/9 "2022-10-07T07:42:54Z")

</div>

Milcho, the scenario you've mentioned is slightly different and there should not be an issue. Could you share a screenshot of the sample response and configuration you're using so that the team can look into the matter?
