cancel
Showing results for 
Search instead for 
Did you mean: 

API responses not working

JensDeveloper
Contributor II

Hello,

So I created an API specification with these error responses.
‘400’:
description: Bad request. ID must be an integer
‘401’:
description: Authorization information is missing or invalid
headers: {}
content: {}
‘404’:
description: Not found
‘500’:
description: Interal server error (500)
When I uploaded the spec into snaplogic and changed the pipeline I want it to fetch data from SQL server select with given ID. I want to reroute the error when the ID is not found.
image

But when I do that I still get on the API call the Server error 500 form the snap itself of snaplogic and not from the reroute or from the specification defined error response
image

Does someone know why it does not reroute the error to my custom error view or the response code from my api specification

1 ACCEPTED SOLUTION

jcornelius
New Contributor III

From the error you posted, the Map data snap is looking for $ID but $ID does not exist in the document stream, check your input doc values

View solution in original post

4 REPLIES 4

jcornelius
New Contributor III

From the error you posted, the Map data snap is looking for $ID but $ID does not exist in the document stream, check your input doc values

Hi jcornelius, Yeah I saw I forget to change that but there was also something else. I’m now investigating it and if I don’t find it I will post the correct topic. Thanks for the info.

bojanvelevski
Valued Contributor

I agree with @jcornelius, The snap with label “Map data” is failing because it’s not receiving the ID field. Basing on your explanation, the ID field should be in the “original” object, so you should map $original.ID

jcornelius
New Contributor III

JFYI to trap error I used the $statusCode
image