12-18-2023 01:45 PM
Hello all,
I created a triggered task, and the system triggering the task sends a couple of query parameters that I need to use for the task.
Can someone tell me how I can get the values passed as query strings when the task was triggered by the URL?
Thanks a lot in advance!
JF
Solved! Go to Solution.
12-19-2023 01:28 AM - edited 12-19-2023 02:16 AM
1) You can define the parameters(the ones that are expected to be sent by the system) in the pipeline properties, and access the parameters with "_" and the name of the parameter. ex: _param1.
2) You can access all the parameters with the QUERY_STRING argument.
ex: _QUERY_STRING
The result is string containing all the parameters sent by the system. ex: "test=value&test1=value1".
So, probably you will need to utilize some of the string functions in order to get/extract the parameters.
12-19-2023 01:28 AM - edited 12-19-2023 02:16 AM
1) You can define the parameters(the ones that are expected to be sent by the system) in the pipeline properties, and access the parameters with "_" and the name of the parameter. ex: _param1.
2) You can access all the parameters with the QUERY_STRING argument.
ex: _QUERY_STRING
The result is string containing all the parameters sent by the system. ex: "test=value&test1=value1".
So, probably you will need to utilize some of the string functions in order to get/extract the parameters.
12-19-2023 08:06 AM
Hello @SpiroTaleski,
Thanks a lot for your reply, both options work perfectly well for me! 🙂
I wish you have a great day!
Kind regards,
JF
12-19-2023 11:18 AM
Hello again @SpiroTaleski,
May I bother you with another question if you don't mind?
What about the other data passed during the call?
In the documentation of the application sending the webhook that I'm monitoring, they say that the callback is sent as a POST request with an application/x-www-urlencoded content type and an 'additionalData' field in the request payload containing a JSON body.
I tried to configure and capture that 'additionalData' field in the pipeline parameters and in the mapper snap that reads the input from the JSON parser snap used in the open end of the pipeline, and I'm getting this error message:
Unable to parse JSON input, Unrecognized token 'additionalData': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
This is what the pipeline looks like (it's not doing anything yet, it's just writing the payload into a file):
There is no file written by the "File Writer" snap because of the error, however there is a "request-content-<data-time>.bin" file that is automatically created, and it contains the "additionalData" values that I'm expecting and looking for.
How can I get that "additionalData" (request content) in my pipeline?
Many thanks in advance again! 🙂
JF
12-20-2023 01:12 AM
How the "additionalData" is sent to SnapLogic endpoint?
Is it sent as query parameter? ex: https://elastic.snaplogic.com/api/1/rest/slsched/feed/example/jobs/test-hello?additionalData=testVal...
If yes, then you will need to access the pipeline parameter in the Mapper Snap(ex:_additionalData).
If the field is sent in the request payload, then you can access the field in the Mapper Snap(ex: $additionalData).