Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Unable to get the success response in POST method using Karate

I have below POST method request for a REST API service:

Given url 'http://ip/service/'
And path 'abc'
And header Content-type = 'application/json'
And request {data:48,data2:{data3:0,textValue:"string",data:0,lastUpdated: "2018-11-27T14:42:37.260Z"}}
 * header Authorization = 'string ' + token

Now, while running I always get 400 throwing the error "missing data2".
I tried to modify the data2 like below:
 * def var = {data3:0,textValue:"string",data:0,lastUpdated: "2018-11-27T14:42:37.260Z"}
 * string str = var

And then use str as '#(str)' in request but still getting 400 error.

Please help.

Comments