cancel
Showing results for 
Search instead for 
Did you mean: 

Where can I get the query parameters when using a triggered task?

jfpelletier
Contributor

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

1 ACCEPTED SOLUTION

SpiroTaleski
Valued Contributor

@jfpelletier 

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. 

 

 

View solution in original post

10 REPLIES 10

Hello @SpiroTaleski,

The "additionalData" is not sent as query parameter, and I can't seem to capture it as payload with the mapper.

This is what my mapper looks like, and I'm still getting the same error message:

jfpelletier_0-1703073321229.png

I also tried to use simply "$" instead of "$additionalData" in the Expression field, but same error message...

I used the "webhook.site" website utility to capture the full data, and the "additionalData" field was displayed in the "Form values" section (sorry about the blurred sections, I have to anonymize before posting...):

jfpelletier_1-1703073900829.png

 

Thanks,

JF

SpiroTaleski
Valued Contributor

@jfpelletier 

As I can see from the first screenshot, seems to fails on JSON Parser Snap. So, it looks like that the message being sent from the system is not valid JSON. 

Hello @SpiroTaleski,

Indeed, the JSON doesn't make it to the mapper, so the issue seems to be with that input...

I have taken the value that webhook.site returned for that field and validated it, it is valid JSON apparently...

I tried to check the "Non-standard JSON" option in the JSON parser snap, but there's no change, I'm still getting the error.

Any idea?

Thanks!

JF

Hello again @SpiroTaleski,

I think that I'm getting somewhere, however it's still not working.

To fix the issue with the invalid JSON, I started the pipeline with a "Document to Binary" snap, and I'm not getting the error anymore!

jfpelletier_0-1703102718240.png

What happens however is strange... The File Writer snap creates the files with the content I'm looking for, and now I realize why it's not valid JSON, it's because somehow all the double quote characters ( " ) have been escaped by a backslash ( \" ) making the JSON not valid. Like this:

jfpelletier_1-1703102937575.png

The other strange thing is that I'm not getting the values from the query string anymore... Actually I do, and found the data by accident, when I tried to use the option "Write header file" in the "File Writer" snap. There was an extra file with the extension ".header" created, and it contained the query string that I couldn't find:

jfpelletier_2-1703103227547.png

I need to use that information from the header file (query string), but I don't know where to find it in the snap variables...

Any idea?

Thanks a lot in advance!

JF

SpiroTaleski
Valued Contributor

@jfpelletier 

Try first to store the data being sent from the system in a file on SLDB. 

Put only File writer Snap with open input view, and store the data as JSON. 

Then you can analyze the validity of the the JSON.