Chas_Schley
17 years agoOccasional Contributor
Substituting query parameter values into a REST resouce path
We have a REST service that places variable parameters as part of the request URI (instead of passing them in as query parameters). The general form of the URI is:
/metadata/device/{deviceId}/image/{imageId}
For example, a GET of /metadata/device/123456/image/987654 would return metadata related to device 123456 and image 987654.
My test step is the keeper of the particular device and image IDs, and I need to pass those values in to the URI that gets called as part of the REST service.
When I hard-code specific device and image IDs into the Resource Path on the resource and then invoke a test step, then I get a valid response. I have tried these substitutions:
/metadata/device/{deviceId}/image/{imageId}
/metadata/device/${deviceId}/image/${imageId}
/metadata/device/{#deviceId}/image/{#imageId}
/metadata/device/${#deviceId}/image/${#imageId}
/metadata/device/${#TestSuite#deviceId}/image/${#TestSuite#imageId}
and each of them spit up:
ERROR:java.lang.Exception: org.apache.commons.httpclient.URIException: escaped absolute path not valid
in the error log.
What's the trick for pushing teststep-level properties into a REST resource path?
Thanks!
_chas_
/metadata/device/{deviceId}/image/{imageId}
For example, a GET of /metadata/device/123456/image/987654 would return metadata related to device 123456 and image 987654.
My test step is the keeper of the particular device and image IDs, and I need to pass those values in to the URI that gets called as part of the REST service.
When I hard-code specific device and image IDs into the Resource Path on the resource and then invoke a test step, then I get a valid response. I have tried these substitutions:
/metadata/device/{deviceId}/image/{imageId}
/metadata/device/${deviceId}/image/${imageId}
/metadata/device/{#deviceId}/image/{#imageId}
/metadata/device/${#deviceId}/image/${#imageId}
/metadata/device/${#TestSuite#deviceId}/image/${#TestSuite#imageId}
and each of them spit up:
ERROR:java.lang.Exception: org.apache.commons.httpclient.URIException: escaped absolute path not valid
in the error log.
What's the trick for pushing teststep-level properties into a REST resource path?
Thanks!
_chas_