jeudi 15 février 2018

postman test scripts and the "_" character in HAL links

Our developers are using _links to define a series of links in any given response e.g.

 "_links": {
    "personImage": "/personImage/image/1"}

Would link to the API to return images. From what I read, this is all good using HAL.

But, in order to chain postman requests together I am trying to extract the relative URL to formulate a full URL using a HostName environment variable using the code below and the script is failing.

postman.setEnvironmentVariable("imageURL",jsonData._links.personImage)

What am I missing here? I've tried escaping it using / to no avail.

Aucun commentaire:

Enregistrer un commentaire