Does xpath or json path get evaluated in pipeline parameters?

I am trying to see if I can retrieve the payload when a pipeline is exposed as a task?

Example:
Payload : 10

Pipeline parameter:
p = /a/b OR $.a.b

I want ‘p’ to take the value as 10 (in this case) and show up under pipeline parameter when ‘capture’ is enabled.

Is this supported? If yes, how?

You cannot set the parameters values once inside the pipeline. They are ready-only.

You can set them only from outside passing values to them either externally or from a different pipeline.

Yeah, I got that.

What I am trying to do is if the parameter is given an expression will it evaluate it?

If we give an xpath or json path (whose value will be in the document that the pipeline receives) will the xpath be populated with correct values?

Yes definitely. It should!!

I made this simple pipeline to test,

input :

{
  "firstName": "John",
  "lastName" : "doe",
  "age"      : 26,
  "address"  : {
    "streetAddress": "naist street",
    "city"         : "Nara",
    "postalCode"   : "630-0192"
  },
  "phoneNumbers": [
    {
      "type"  : "iPhone",
      "number": "0123-4567-8888"
    },
    {
      "type"  : "home",
      "number": "0123-4567-8910"
    }
  ]
}

the response I get is,

[{
   "firstName": "John",
   "lastName": "doe",
   "age": 26,
   "address":    {
      "streetAddress": "naist street",
      "city": "Nara",
      "postalCode": "630-0192"
   },
   "phoneNumbers":    [
            {
         "type": "iPhone",
         "number": "0123-4567-8888"
      },
            {
         "type": "home",
         "number": "0123-4567-8910"
      }
   ],
   "a":    {
      "a": "pipe.label",
      "payload1": "$",
      "REMOTE_ADDR": "35.156.60.10",
      "xpath_city": "/root/address/city",
      "HTTP_DATE": "",
      "REMOTE_USER": "",
      "HTTP_REFERER": "",
      "REMOTE_PORT": "",
      "QUERY_STRING": "",
      "payload": "$",
      "CONTENT_TYPE": "application/json",
      "HTTP_ACCEPT": "",
      "REQUEST_METHOD": "POST",
      "jsonpath": "$.address.city",
      "HTTP_USER_AGENT": "Apache-HttpClient/4.1.1 (java 1.5)",
      "HTTP_ACCEPT_ENCODING": "",
      "PATH_INFO": ""
   },
   "b": false
}]

TestParam_2017_11_10.slp (2.5 KB)

The xpath or json path are not getting evaluated.

@krupalibshah, I think the eval() function is what you’re looking for. See if the following additions to your mapper help point you in the right direction.

Yes, the eval() function should be used to dynamically evaluate an expression. There is also jsonPath() function to dynamically evaluate a JSON-Path.

Thanks!

But this is not what I am aiming to do, I want to check if I give an xpath or json path in pipeline parameters (under edit pipeline) will they be evaluated and give me corresponding result?

Can you give me an example?

Here is what works.

eval-pipeline-params_2017_11_13.slp (3.3 KB)

1 Like

In your example, I see pipeline parameter with json path.
If we capture its value, and invoke the pipeline via a triggered task, will the parameter be evaluated to value 10 and the same will be shown under pipeline parameter in execution statics?