Forum Discussion

JensDeveloper's avatar
JensDeveloper
Contributor II
4 years ago
Solved

API responses not working

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.

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

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

  • 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

4 Replies

  • jcornelius's avatar
    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

    • JensDeveloper's avatar
      JensDeveloper
      Contributor II

      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's avatar
    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