cancel
Showing results for 
Search instead for 
Did you mean: 

REST GET snap

viji28
New Contributor

Hello Team,

I would like to know about a capability. Explaining below:
Lets assume i have a json object :

{“country”: “US”,
“event”: “CREATED”,
“OrderNumber”: “1125”
}

From the above JSON, i would like to pass the OrderNumber to REST GET snap.
The REST API is an inhouse API and is designed in such a way that , if we pass an order number , it send backs all relevant details like invoice date , billed by , billing number , order number etc

but when it does not find any match , it does not send any output .

I would like to build a case where if the match is found through the API , we would pass the billing number
but when the match is not found , we will provide a default number.

My issue is when the order number is not matched in the API , i do not get any output. Is there a way where we can enable pass through ?so that i get the original order number or schema passed ?

2 REPLIES 2

JensDeveloper
Contributor II

Hi @viji28 ,

What I understand from your use case is that you also don’t get an error if it doesn’t find any match?

If so, from my experience I always had the possibility in rest get snaps the ‘pass through’ option and after that I used a router or a mapper snap that checks if a value exists or not for example:
$.get(BillingNumber, defaultValue).

In your case when you don’t have a pass through. I would suggest you put a mapper snap or a router snap next to it and fill in the expression: $.get(‘targetvalue’) == true ? $targetvalue : default number

I haven’t tested this scenario yet because I had always the possibility with the ‘pass through’ option.
Let me know if this helps you or not.

Regards

Jens

Hey Jens,
I unchecked process array and that did the trick.

Thank you!