cancel
Showing results for 
Search instead for 
Did you mean: 

Pass the json input request payload to REST GET

arunnp
New Contributor II

Hello,
I am new to Snap logic, I am trying to create a pipeline where I need to pass the json input request payload. based on the input I have to check for condition and then route to TWO different REST GET calls.
my input json is like this
{
“state”: “sample_state”,
“count”: “sample_count”,
“Caller”: “sample_caller”,
“fromDate”: “sample_fromdate”,
“toDate”: “sample_todate”,
“SysId”: “sample_sysid”
}
how to pass this from external app. And how to read the values to pass to REST GET call.
Answer will help a lot. Thanks

12 REPLIES 12

viktor_n
Contributor II

Hi @arunnp,

You can pass data from external app by creating Triggered task.
This task can be created from Manager or from the Designers.

So these are the steps:

  1. Create Pipleline.
  2. Because the payload is in JSON format, get one JSON Parser snap and after that you can map the fields wherever you have Expression Builder.
  3. On the same pipeline on the right top corner click on Create Pipeline and select Triggered Task.
    image
    It will open up new window, click Save.
    After that go in Manager and go into the project where the pipeline is created and find the task(It will be the same name as the pipeline only the “Task” will be added in the name at the end. If you set different name search by that name), hover on the name of the task and it will show up arrow, click on the arrow and go in Details.
    Select the Cloud URL: this is the URL from where you will trigger the task also there is HTTP Header for authorization. You can authorize the call by Bearer Token or with Basic Authorization.
    image
    On that url you can send the JSON payload.

I also attaching pipeline as example, but you will have to make the task on your own.
JSON_Payload_2021_08_02.slp (4.8 KB)

Here is one example triggering the pipeline above from Postman.
I am not doing anything just move the whole payload to Payload object and returning it back.
image

Regards,
Viktor

arunnp
New Contributor II

Thanks this helped me lot.
Once I get the input values I need to pass that to the REST get Service URL but the value is not passing.

I am doing like this
incidentRed
Here the caller is not getting replaced. I am getting empty response.
I tried {{$Caller}} still no response. I am missing proper syntax. can you pls help with proper syntax.
thanks

viktor_n
Contributor II

To get value from Caller field you first need to check the Expression Builder(=), and to get the value you need to make everything as string only the $Caller to be as expression.

For example from the image above need to look like this:
image

angie
New Contributor

Hi, @arunnp

  1. The service url needs to start with “http(s)://” and then specify ble/incident. For example http://ble/incident
  2. For better reading of the URL, instead of concatenating the strings under Service URL, you can pass the input parameters under “Query parameters”. So depending how many query parameters will be used, you can add more by using +. See the example in the picture

image

Regards,
Angela.