cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Map Incoming JSON Body

whaleyl
New Contributor III

I have a requirement for a pipeline that is supposed to accept an incoming JSON body/payload of attributes in place of sending parameters via the task URL for security related reasons.

For the sake of simplicity, we are trying to accept something in a similar format as seen here:

{
โ€œIDโ€: 15,
โ€œfirstNameโ€: โ€œJonโ€,
โ€œlastNameโ€: โ€œSmithโ€
}

So far we have tried to โ€œacceptโ€ incoming data through a Mapper snap with no success. We have tested the pipeline by executing the task URL, and passing the JSON body data in tandem. Weโ€™ve tried formatting a Mapper snap in the following way at the beginning of our pipeline:

mapper

Is there a way of doing this correctly with the default, OOTB snaps? We do not currently utilize any extra snap packs. Thank you for the help in advance.

1 ACCEPTED SOLUTION

del
Contributor III

The beginning snap should be a JSON Parser that would feed into your Mapper snap.

View solution in original post

4 REPLIES 4

del
Contributor III

The beginning snap should be a JSON Parser that would feed into your Mapper snap.

whaleyl
New Contributor III

Hi del, thanks for the response.

To clarify, I shouldnโ€™t need to place anything else before the JSON Parser snap correct? Everything thatโ€™s being fed to the pipeline via the JSON body/payload will be read by the Parser and then passed to my Mapper?

del
Contributor III

That is correct. Two things to note:

  • this may be obvious, but the client/consumer must submit an HTTP POST method instead of a GET method
  • as a matter of practice, the consumer should set the HTTP header Content-Type to "application/json "(although Iโ€™m not certain itโ€™s necessary for SnapLogic with the JSON Parser as the beginning snap)

whaleyl
New Contributor III

Excellent, both very helpful tips.

I was able to test this method, and can confirm it works great. Thanks again for the quick help!