Forum Discussion

vikititor's avatar
vikititor
Contributor
5 years ago
Solved

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.

  • 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

1 Reply

  • 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