API Test Automation

Hello Everyone,

Regarding API automation, Can we check the body contents of an API response PLZ.
Exemple :

{ “id”: 187, “creationUser”: “Testtest”, “creationRemoteUser”: “TEst”, “cancelRemoteUser”: null, … }

If yes how can we do it?
FYI : I’m not talking about the response Status: 200, 400, 500, …

Best Regards,

Hi Morad,

Which library are you using to call the api? The answer to your question will vary depending on the library.

If you can show an example of how your calling the api i’ll try to show how you could modify your code to get the response.


Hello Dave,
Thanks for your replay.
You will find below an exemple of an api call :

${json_string}= catenate
… {
… “rtnId”: “0123654788”,
… “individualAddress”:{
… “firstName”:“Morad”,
… “lastName”:“Amchari”,
… “title”:“M”,
… “addr1”:“4, rue du Clair Bocage”,
… “addr2”:“B3”,
… }
${body} = evaluate json.loads(‘’‘${json_string}’‘’) json
${response} = POST /pull ${body}

Hi Morad,

You didn’t really answer the question, are you using POST from Requests library?

If yes, you don’t really need ${body} = evaluate json.loads(‘’‘${json_string}’‘’) json you can simply do this:

${json_string}=    catenate
… {
… "rtnId": "0123654788",
… "individualAddress":{
… "firstName":"Morad",
… "lastName":"Amchari",
… "title":"M",
… "addr1":"4, rue du Clair Bocage",
… "addr2":"B3",
… }
${response}=    POST    https://your.host/pull    json=${json_string}

But if you want to just pass the path and not the host details you should probably use POST On Session after creating your session with Create Session

Also be careful with your double quotes (some windows programs mess them up is not the same as " and is not valid JSON.


Hi Dave,
Sorry for the missing response, Yes exactly i use :

Library RequestsLibrary

After the launch of this API request i receive two Data’s,

Response status: 200
Body :
{ “id”: 187, “creationUser”: “MoradAM”, “creationRemoteUser”: “Robot”, “cancelRemoteUser”: null, … }

My question is how can i check the contains of the Body.


This YouTube video shows how to validate API response body content:

Part 3- POST Request | Rest API Testing using Robot Framework


Thank you So much.
Appreciate that

Hi Morad,

You can also refer to Response Object in the RequestsLibrary documentation ${response.json()} should give you a dictionary that you can test i.e.

Should Be Equal As Integers	${response.json()}['id']	187
Should Be Equal As Strings	${response.json()}['creationUser']	MoradAM


1 Like

Hello Dave

Thank you for the response and your time regarding this topic.


1 Like