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

Triggered Task to receive application/x-www-form-urlencoded

gg433
New Contributor III

I want to invoke a triggered task from another application. The other application is using POST method with name/value pairs in a querystring and the content type is x-www-form-urlencoded.

example: POST https://somesite.com?Email=test@test.com&name=Bill
header Content-Type application/x-www-form-urlencoded

I have not had any luck getting a Triggered task to run using POST, only GET. Does anyone know where I can start to get this to work? How do I receive the name/value pairs? I can get it to work using pipeline parameters, but not when I use POST.

POST /api/1/rest/slsched/feed/xxxxxxx/projects/Gary_Gaetano/Lead%20Triggered%20Task?bearer_token=xxxxxxxxxxxxxx HTTP/1.1
Host: elastic.snaplogic.com:443
Content-Type: application/x-www-form-urlencoded
User-Agent: PostmanRuntime/7.19.0
Accept: /
Cache-Control: no-cache
Postman-Token: xxxxxxxxxxxxxxxxx
Host: elastic.snaplogic.com:443
Accept-Encoding: gzip, deflate
Content-Length: 95
Connection: keep-alive
cache-control: no-cache

First_Name=testfirst&Last_Name=testlast&Email=11062019758gg%40adptest.com&Company=adp+testing
Response:
Pipeline execution failed or was aborted.

This one was successful:
GET /api/1/rest/slsched/feed/xxxxxxx/projects/Gary_Gaetano/Lead%20Triggered%20Task?bearer_token=xxxxxxxxxxxxxxx& First_Name=testfirst& Last_Name=testlast& Email=11062019618gg@adptest.com& Company=adp testing HTTP/1.1
Host: elastic.snaplogic.com:443
cache-control: no-cache
Postman-Token: xxxxxxxxxx

My pipeline is one snap, a JSON generator that takes the pipeline parameters and responds back, one open input and one open output.

Gary

2 REPLIES 2

tlikarish
Employee
Employee

Sorry this is kind of clunky at the moment. Iโ€™ll file some tickets to make it a little smoother in a future release. For now though, only triggering with a Groundplex via the on-premise or local override urls will accept x-www-form-urlencoded values and properly parse for you. One catch is that the values of the keys will be wrapped in arrays, so youโ€™ll have to unpack them.

Hereโ€™s an example pipeline that demonstrates how it works.
greeter-example_2019_11_07.slp (2.6 KB)

You can invoke like this.

$ curl -H 'Authorization: XXX' <on-premise url here> -d 'greeting=hello,' -d 'name=Tim'
[
  {"message":"hello, Tim"}
]

gg433
New Contributor III

Thanks, I will try this out.