Forum Discussion

richie's avatar
richie
Community Hero
6 years ago
Solved

Is there anyway to parameterize a REST APIs Query PARMS?

Hi,   I've been trying to find alternative ways around the same problem - and I asked a similar question today but perhaps from a different perspective - so I apologise if this appears to be the ...
  • Lucian's avatar
    6 years ago

    Hi richie,

     

    It should work but it is not ${TestCase#value} but ${#TestCase#value}.

     

    ReadyApi has the following rules:

    1. If you define the scope you put a # in front of it like in: {#TestCase#...}, {#Project#...} or ${#TestSuite#...}

    2. If you are reffering to a test step you use it without a # like in ${GetSessionId#...}

     

    Cheers!

  • ashu248's avatar
    6 years ago

    richie

    using groovy we can add parameters at run time.kindly, try the below code snippet:-

    *********************************************************************

    def step=testRunner.testCase.getTestStepByName("REST")
    def req=step.httpRequest
    req.removeProperty("name")
    req.getParams().each{
    log.info it.value.name
    }

    //required to add field before setting the value  
    req.addProperty("name")

    // set the new field value
    req.setPropertyValue("name","abc")

    ******************************************************************

    Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.Smiley Wink