hurl icon indicating copy to clipboard operation
hurl copied to clipboard

hurl captures get object and use next variable

Open baerwang opened this issue 1 year ago • 2 comments

Problem to solve

hurl captures get object and use next api

roles api response

{
  "success":true,
  "result":[
    {
      "uuid":"1",
      "name":"Reviewer",
      "created_at":"2024-05-29T04:09:40Z",
      "updated_at":"2024-07-10T12:20:46Z",
      "xxx": ....
    },
    {
      "uuid":"2",
      "name":"Admin",
      "created_at":"2024-05-29T04:09:40Z",
      "updated_at":"2024-07-10T12:20:46Z",
      "xxx": ....
    }
  ]
}

captures get values

GET {{openapi_server_v1}}/roles
Content-Type: application/json
Authorization: Bearer {{access_token}}
HTTP 200
[Captures]
admin: jsonpath "$.result[?(@.name=='Admin')]" nth 0
reviewer: jsonpath "$.result[?(@.name=='Reviewer')]" nth 0
[Asserts]
jsonpath "$.success" == true

get values and next api use

POST {{openapi_server_v1}}/api_tokens
Content-Type: application/json
Authorization: Bearer {{access_token}}

{
    "name": "admin",
    "role": {{admin}}
}

HTTP 201
[Asserts]
jsonpath "$.success" == true

error info

image

baerwang avatar Sep 10 '24 10:09 baerwang

Hi there, is this issue fixed? I encountered the same issue, any other solutions to prevent this error?

seyoatda avatar Aug 21 '25 07:08 seyoatda

Hi @seyoatda

Currently templating of a captured object is not supported, the alternative is to capture individual property and render it where you need it

jcamiel avatar Aug 21 '25 09:08 jcamiel