How to bring API JSON text into REST Post Snap?

Hi all,

I am trying to use a JSON file to feed in the body of a response that is working in Postman with curl code like this:

In SnapLogic I added the raw body in a JSON generator and want to feed that into a REST Post Snap. My pipeline looks like this:

image

With no headers nor queries in Postman, only the JSON/raw body and the service URL, I retrieve results with no issues. However, with Snaplogic I am not receiving output. Has anyone done this? I am told I cannot incorporate the credentials into the headers, it must be in the body…but how do I reconcile this with SnapLogic? No one on my team has worked on something externalized that has functioned in this way.

Thanks!

@ariana you can try below option-

  1. Use mapper and copy entire body {“email”:"",…} and use target field as $ in mapper.
  2. You don’t need to touch anything related to file upload option, rather add header field like below.
  3. Also make sure you choose snap execution as "validate and execution" at below.

Hi there! Thanks for your help. Here is what I am looking at now, still no output:
Mapper -

Mapper validation output -
image

POST Snap:


Pipeline:
image

Edit: I will add that I did try simply copying the body into the mapper with “$” in the Post snap but with the same (lack of) results.

Change HTTP entity from $entity to JSON.stringify($entity).

Hi ptaylor, thank you for the addition. Do I need to change any other settings if doing that? I am not getting output still :frowning:
image

image

image

This is the preview I get when I hover over stringify- is that what I would want? image

Apologies, I started a new snap to try out your method and it was Execute only. Now I am getting an error. I think that is an improvement over nothing, but need to figure it out.

image

Ok, the default Snap Execution of Execute Only explains why you weren’t getting any output when validating. Actually, I don’t think the JSON.stringify($entity) is really necessary, since $entity in this context will implicitly convert the input data to a JSON string.

It looks like the web service you’re invoking needs some authentication, and there are different ways of handling that. Please check the docs for the target web service regarding the required authentication.

Did you configure your REST snap with an error view? If so, see if the error_entity field in the error document tells you anything useful.

The error view output tells the same story, that it is forbidden. We are asking another engineer who has worked on external APIs as well. We aren’t sure if it is a security/whitelisting issue. I appreciate your help. I might get back here for questions again if there is anything else on the SnapLogic side.