Ask a Question

serviceV how to get resource path parameter in script

SOLVED
vikititor
Contributor

serviceV how to get resource path parameter in script

How I am able to use resource parameter in dispach script? For example I have mock REST service "context/{resourceID}/otherPath"

What I want to use is the "resourceID" in my response. So I need read the value form request. But no idea how to do this.

Proper response is selected - there can be just one. In this response is inline script for reading project propertie. 

But how to put value in to project propertie???

 

Any idea?

Thanks a lot in advance for your advice.

1 REPLY 1
vikititor
Contributor

I am parsing request resource path in my response in script like this:

my MOCK operation is: POST submit/{ORI}/method

and how I am getting ORI value in my response is done by this script. Then value is used in future in response..

But I hope there must be more comfortable way, how to get this..

def requestPath = mockRequest.getPath()
log.info "Path: "+ requestPath

requestPath = requestPath.replace("/submit/", "")
def ORI = requestPath.substring(0, requestPath.indexOf("/"))
log.info "ORI: " + ORI

return
cancel
Showing results for 
Search instead for 
Did you mean: