Forum Discussion

Mason's avatar
Mason
Frequent Contributor
14 years ago

Parameterizing REST URI

Does soapUI support REST URIs that are generated after an HTTP Post via XML?

The system I am working with requires an authenticated POST of XML type where XML is passed in with certain parameters. If there is a result set from the search parameters, the system generates a URI and passes this back in the response.

For example:
<ns2:PetsResults xmlns:ns2="http://pets-search.com/api/1.0">
<Uri>http://pets-search.com/api/v1/pets/searchResults/8a5ec8142b356e5a012b360e81a903eb</Uri>
</ns2:PetsResults>


This URI has a limited lifetime and only lasts for 8 hours and then is removed from the system's database.

Is it possible to transfer this URI from the HTTP response into a REST request? Can the Resource/Method be parameterized?

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    From the look of your post it looks like the URL follows a general structure, where only parts of it change. If so I would recommend using TEMPLATE parameters. To do this open the REST Resource and add a new Resource Parameter, name it for instance "searchId" and make sure the Style of it is set to TEMPLATE. Then modify the Resource Path to for example: "api/v1/pets/searchResults/{searchId}". This allows you to parameterize parts of the path. Once this is set up, you can use a Property Transfer step to transfer the correct value from the XML Response to the correct parameter.

    If the structure of the URL can't be assumed, then you can either use Property Expansions for the entire path in the Request, or possibly simpler, use a HTTP Request TestStep where the endpoint uses a Property Expansion. Good luck!

    Regards,
    Dain
    eviware.com