Forum Discussion

beeemy's avatar
10 years ago

Can resource path of a REST API be changed by data source?

for example lets say i want to perform a GET request on a URL that looks like:

resourcepath/ID?parameters

is it possible to use a data source with ID's to loop through and perform a GET request on each ID?

4 Replies

  • Cizo89's avatar
    Cizo89
    Frequent Contributor
    Hi,

    yes, it's possible and probably the best and most effecient way to do this is via DataSource TestStep.
    Since you're asking this question in the Community board, I assume you don't have the Pro version - this is an ideal oppurtunity to purchase it

    Although it can be done by Groovy script as well, I'd recommend you buying the Pro version and following instructions on following page
    http://www.soapui.org/Data-Driven-Testi ... tests.html

    Regards,
    Marek
    • padmanabam's avatar
      padmanabam
      New Contributor

      Hi

       

      Can u kindly help me how to access the Resource Path of Rest Test Request which is a Rest TestRequestProperty using Groovy scripting.. I am actually soapui 4.5 open source and our project doesnot Pro version for using Data Source step. Can u please provide that code snippet for accessing the Resource Test Request property using groovy, because i have to update that dynamically... Please let me know how to access and how to update that as well. Ur help is really appreciated. Thanks in advance..

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        For this one, I think you might be asking just how to provide the ID as a variable for a REST Request TestStep as a path parameter e.g. 


        If you had:

         

        http://localhost:7070/quote/{id}?parm={val}

         

        In this case, it is important to define your parameters a certain way:

         

        id - should be setup style='TEMPLATE'  

        parameters - should be setup style='QUERY'

         

        Then you can provide their values using property expansions (the values of {id} and {param} can be provided for example using a Groovy TestStep, need more examples please ask) - see attched screen shot.

         

        soapui-params.png

         

        Does this make sense?

         

        In terms of the previus answer reagrding using a datasource to provide these values, I am inclined to disagree that the pro version is necessary, whilst it is definately convenient with its build in Datasource TestStep. It is actually quite straightforward to provide many different types of data source/data driven tests in the open source version, assuming you aren't concerned about using a littel Groovy script. Happy to discuss examples further if you need details.

         

        Hope this helps,

        Cheers,

        Rupert