Forum Discussion
Many thanks for the clarification around the header. Just curious about the other horizontal panels such as "Auth", given that you have mentioned the Horizontal Request panel only applies to individual requests. Does that mean Authentication configured through that tab would only apply to a individual request, and that you could have different authentication configurations for different requests within a individual REST service project in ReadyAPI?
This next question isn't really around the header, but as it's related to one of the REST service API methods I'm attempting to test, I'm raising it under this topic. This is the JSON request code snippet which I've been given to try & simulate/setup in ReadyAPI.
*******************************
HEADERS = {'apitoken': XXXX}
resp = requests.post(
url= 'https://xxxx.xxxxxxx.com/rest/xxxx/search'
data={'name': nameArg, 'country': countryArg},
headers=HEADERS
)
*******************************
Would you be able to confirm if this is the correct way to set it up in ReadyAPI? A JSON (not XML) request and response would be required here. The associated screenshot is attached.
Method = POST
Endpoint = https://xxxx.xxxxxxx.com
Resource = /rest/xxxx/search
Vertical Request Parameters tab line items:
Name: name, Value: nameArg, Style: QUERY, Level: METHOD
Name: country, Value: countryArg, Style: QUERY, Level: METHOD
Name: apitoken, Value: XXXX, Style: HEADER, Level: RESOURCE
MediaType = application/json
Having read through some further ReadyAPI Documentation, I see that the text area below the Media Type (application/json) dropdown is called the "Content Editor".
Is this where the json request body arguments should be set? I.e. rather than as request parameters under the Parameter editor?
HEADERS = {'apitoken': XXXX}
resp = requests.post(
url= 'https://xxxx.xxxxxxx.com/rest/xxxx/search'
data={'name': nameArg, 'country': countryArg},
headers=HEADERS
)
I.e. for the JSON example I am trying to simulate/test (above) in ReadyAPI, should I be entering the following under the "Content Editor", instead of adding them as request parameters?
{'name': NameArg, 'country': CountryArg}
- PaulMS7 years agoSuper Contributor
Yes it seems that the name/country data would be included in the content editor so you don't need name/country parameters.
There is a JSON request example in https://support.smartbear.com/readyapi/docs/projects/ui/request/request/vertical/rest.html
The Raw panel is also useful to see the actual request that was sent
https://support.smartbear.com/readyapi/docs/projects/ui/request/request/vertical/raw.html
Authorization can be different for any request
https://support.smartbear.com/readyapi/docs/projects/requests/auth/index.html
- tgunasek7 years agoNew Contributor
Thank you both for your comments. I found the RAW panel to be quite useful while testing.
I've now managed to setup and test the two REST services with a JSON Request, returning a JSON Response.
- Bill_In_Irvine7 years agoContributor
"is this where the json request body arguments should be set?"
Yes - at least that's how it works for me. [ edited] - for clarity for any POST method that has a lot of name/value pairs I use the JSON form for clarity and ease and use that editor window below "Media Type" to put my JSON. I don't do headers in that space.
Related Content
- 5 years agoSiKing
- 10 years agochuddy12345