Ask a Question

Property transfer - concate request result with constant/property value

Marvin30171
New Member

Property transfer - concate request result with constant/property value

Hello Guys,

i made a rest-request which returns me an  url (orders_url) (see https://api.predic8.de/shop/docs#!/customers/getCustomersId )

https://api.predic8.de:443/shop/customers/1

result:

{
  "firstname": "Joe",
  "lastname": "Newman",
  "orders_url": "/shop/customers/1/orders/"
}

Now i want to use orders_url  as endpoint in the next request to check the result. To do this i have to concate the base url (https://api.predic8.de:443)  with the orders_url to get the fully url (https://api.predic8.de:443/shop/customers/1/orders/)

 

is it possible to do that in property transfer or at least in any other way?

 

i thought i could just concate the result with the base url 

$.concat("https://api.predic8.de:443",$.orders_url)

or  with a property expansion

$.concat(${#TestCase#baseUrl},$.orders_url)

but nothing worked. How ever it seems to be that properys that retrieved with the get-data-funtion will not work in property-transfer-dialog, even if the context menue allows me to pick that data using property expansion.

 

this is a picture what if have done

 

Marvin30171_0-1662977755105.png

 

 

how could it be done ?

 

1 REPLY 1
KarelHusa
Super Contributor

@Marvin30171,

your JSONPath does not work. You can use https://jsonpath.com/ or a similar tool to check your JSONPath expression.

 

Additionally, you are trying to set the REST Request step endpoint with a baseUrl and the resource path joined together. Please note that the REST step uses two separate variables, Endpoint and Resource.

 

I would recommend:

  • using REST step and just set up it's parameters (here customerId)
  • using HTTP request step end building whole endpoint (if testing of the provided URL is the goal)

Best regards,

Karel

 

Karel@apimate.eu
https://apimate.eu
cancel
Showing results for 
Search instead for 
Did you mean: