How to store and work with REST post response?

Hello guys,

I am new to Codeceptjs with WebdriverIO and JavaScript and I just started to work with REST helper. I was wondering if there a way to store post response and retrieve values from it?

I would be really grateful if you could share your examples.

You can get access to the data object on the response, like so

1 Like

Yes, the examples are referenced from CodeceptJS docs:
result.status contains HTTP response (e.g. 200 which means O.K.) and contains response (e.g. JSON response).
More details on (CodeceptJS uses axios library to perform REST requests)

Thank you a lot guys. Finally I was able to store response. Now it looks like this:

var response = await I.sendPostRequest(url, postBody);
var users =;

Console output:

{id:‘001c’, name:‘Max’, city:‘London’},
{id:‘002c’, name:‘Tom’, city:‘Bristol’}

My question is, how can I access name field in one or all records? For example if I want to verify it equals expected value?



1 Like

Hello guys,

I am trying the same to fetch the response but somehow I get this error message:- ‘Property ‘status’ does not exist on type ‘void’.ts(2339)’

I see the return type of the I.sendGetRequest(’/rtos’) to be void.

Sample code:-

const res = await I.sendGetRequest(’/rtos’);
expect(res.status).to.eql(200); --> GIves compile time error on this line.

Please help me on this.

Deven J.

Hello Team,

Can someone please help me here ?