Semantic URL Example

Hi,

I would like to know how to correctly pass data via Semantic URL (as a Triggered Task via URL)?

Here is what I did:

Edit Pipeline Properties:

I created an exampleId variable, if I wanted to pass a value of 1 to the exampleId variable:

https://elastic.snaplogic.com:443/api/1/rest/path/to/my/project/pipelineName/exampleId/1

What I have working is:

https://elastic.snaplogic.com:443/api/1/rest/path/to/my/project/pipelineName/?exampleId=1

1 Like

exampleId should have been visible in the PATH_INFO parameter.

Anything that you add after the task url before ? is considered as Path_info.

Please test and reconfirm.

normal task url

https://elastic.snaplogic.com:443/api/1/rest/slsched/feed/<org>/Training/NaveenG/exercise1_trg_task

path info in the task url

https://elastic.snaplogic.com:443/api/1/rest/slsched/feed/<org>/Training/NaveenG/exercise1_trg_task/somepath

In the above, somepath should appear in the PATH_INFO if captured!!

To further clarify (from my testing), PATH_INFO is not required in the Parameters option of the Pipeline but still must be accessed via snaps using the “_” prefix. (i.e. “_PATH_INFO”)

can you post the screenshot what you are observing?

_PATH_INFO should be available throughout the pipeline.

What I did was POST to my Triggered Task URL

https://elastic.snaplogic.com:443/api/1/rest/slsched/feed/org/myproject/path/exampleData/3

I wanted to catch the key value pair of exampleData: 3 so I placed it on the pipeline parameter as exampleData

and then I used the mapper to catch and map it to my exampleData field (for my json).

the output of the PATH_INFO is correct which is “exampleData/3”.
or “examplePath”: “exampleData/3”

but if what I wanted to get was the “exampleData”: “3”. is this possible with semantic URL?

Thank you for responding.

Yes certainly.

do split to get those into array.

_PATH_INFO.split('/') 

Then use the .map function to form a JSON object with key value pair.

1 Like

Thank you! Finally got it to work!

1 Like

@jsgeronimo, Could you please share the map function used to doing this use case as I have a similar requirement

Can you provide your full requirement, it might be easier to help if we know what you’re interested in.

Please ignore. I was making a mistake at my end. Explanation in the post is pretty clear