REST API URL in Extension Tool

tapan1986tapan1986 Posts: 27

How to get the REST API URL in the extension tool ?



  • benken_parasoftbenken_parasoft Posts: 935 ✭✭✭

    URL for what REST API? Where is the URL you are trying to get? In an environment variable?

  • tapan1986tapan1986 Posts: 27

    the current URL I am hitting(in the request). I have to pass that to extension tool for validations of pagination.The URL is created taking host variables from environment and data from Data source.

  • benken_parasoftbenken_parasoft Posts: 935 ✭✭✭
    edited February 2019

    As one possible option for you, you could chain an Extension Tool to your client's "Traffic Object" output then use a Groovy script like this:

    import com.parasoft.api.*
    void test(Map input, ScriptingContext context) {
        Application.showMessage(input.get("End Point"))

    Otherwise, that ScriptingContext object passed to the script also has "getEnvironmentVariableValue" and "getValue" methods you can call to resolve environment variables and data source columns, in case you want to make your script build the same URL from variables and/or data source or data bank columns. Something like:

    context.getEnvironmentVariableValue("BASEURL") + context.getEnvironmentVariableValue("PATH") + context.getValue("Generated Data Source", "column name")
Sign In or Register to comment.