Forum Discussion

jsgeronimo's avatar
jsgeronimo
New Contributor II
8 years ago

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

18 Replies

  • 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!!

  • del's avatar
    del
    Contributor III

    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”)

    • nganapathiraju's avatar
      nganapathiraju
      Former Employee

      can you post the screenshot what you are observing?

      _PATH_INFO should be available throughout the pipeline.

      • jsgeronimo's avatar
        jsgeronimo
        New Contributor II

        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.

  • Edit your pipeline properties and create those keys as pipeline Parameters:

    p_param1
    p_param2

    Then you can reference them in any expression in the pipeline as _p_param1 and _p_param2 (i.e. prefix the parameter name with an underscore)

    • amar's avatar
      amar
      New Contributor II

      I tried it, It’s returning null in output. It’s an ultra task with child and parent pipeline. I gave parameters on parent pipeline

  • Are those being used/returned from the child pipeline then?

    If so, you would need to pass the parameters to the child in the Pipeline Execute

    • amar's avatar
      amar
      New Contributor II

      Yes, i tried to pass both in child and parent but still ultra task not able to detect the query parameters.
      Same pipeline works with triggered task where i can retrieve the parameters

      • SpiroTaleski's avatar
        SpiroTaleski
        Valued Contributor

        @amar

        In order to get query parameters for ultra task, you should to leave one unconnected input view of the ultra pipeline.

        When you try to call that ultra pipeline(from REST client, REST Snaps etc), the query parameters is added to the input document:

        Ex:

        “query”: {
        “testParameter1”: [
        “TestValue”
        ],
        “testParameter2”: [
        “TestValue2”
        ]
        }

        Regards,
        Spiro Taleski

  • amar's avatar
    amar
    New Contributor II

    Thankyou all for the help!