How to omit parameters in a REST request
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to omit parameters in a REST request
Hi,
For my automation project I will have a lot of testsuites and testcases with a lot of combinations. For each testsuite I've entered the necessary parameters to be able to use in each testcase. In ReadyAPI you do that in tab "Projects" on your created webservice.
Now, not all parameters will be filled in for a particular testcase whereas the REST request will send anyways all the parameters as emtpy string.
For this project this is harmful, as an empty string could give an answer, and that isn't what I'm looking for.
For example:
Testsuite parameters: name, cbe_number, country, municipality, neighbours, street, housenumber, po_box
Testcase: Search company on name
For this testcase only parameter 'name' will be filled in, but when I send the request, all other parameters are also filled in in the URL. How can I, per testcase, omit the other parameters please?
Thanks in advance.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Rao, I know I'm a pain in the ass, but I'm someone who likes to learn and understand what I'm reading....in code 🙂
When I look at the Groovy Script there is a part that points to the SERVICE_HOST_PORT that I have declared on Project Level in 'Custom Properties' ( def serviceHost = context.expand('${#Project#SERVICE_HOST_PORT}') )
Can I asume that the script is indeed making contact with the SwaggerHub where our data is on and that the script is not only taking the properties on TestCase level in 'Custom Properties)?
Thanks,
AboveAndBeyond
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Replies on my questions 🙂
1) Yes, the groovy script is indeed making contact with the Enpoint, though I needed to have a lot of patience before the answer came.
2) If I want the result being written in readable json code I need to change the last line of the script:
log.info groovy.json.JsonOutput.prettyPrint(response.toString())
instead of
log.info groovy.json.JsonOutput.prettyPrint(response.text)
or so I've read.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
About omitting the parameters...
If a parameter with an empty value shouldn't be sent, you need to un-check the Required check-box for this parameter in the Advanced options section for this parameter.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NOTE: when you omit the parameter in ReadyAPI as Nastya said, this will be inherited by all testsuites and it's testcases and teststeps of that project. The parameter won't be send as long no value is present in the parameter value field.

- « Previous
- Next »
- « Previous
- Next »