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

Create Custom API - JSON document as POST body

jose_guadamuz
New Contributor II

Hi - Does anyone have an example how to create a custom API which receives a JSON body in a POST.
Also, how to do you specify a POST vs GET in the task?

I found a couple examples but most use parameters which I want to avoid.
Any help is appreciated.

Thanks,
Jose

1 REPLY 1

aleung
Contributor III

REST Get and REST Post are 2 distinctive snap.


08%20PM

As for providing JSON body in a REST POST. It is quite straight forward with this POST to Slack as an example:
35%20PM

Plug in your Slack channel REST URL. โ€œHTTP entityโ€ is essentially your BODY and $ represent the JSON document you are getting from the input. If you have multiple docs feeding into your input, it will execute as many REST POST per doc. If you like to only execute once then you could use Group by snap to push an array into 1 document.

Note: you also have an option to place the actual JSON body in the โ€œHTTP entityโ€ field as well. 58%20PM

For Slack it only needs โ€œtextโ€ in the body of REST POST, so I can feed the message I want to it. 50%20PM