Home > Blockchain >  Rest Assured Java : How to obtain id in the response not in json format
Rest Assured Java : How to obtain id in the response not in json format

Time:01-22

I need to obtain the response of an endpoint that returns a number but not in json format, only a number returns. When I try to do response.prettyprint() I didnt see nothing in the console. Is there any way to obtain that number in the response? Thanks!

CodePudding user response:

To print that information, just use:

Response res = ...
res.print();

To get Infor, save Response as String then convert type to int

String res = ...asString();
int number = Integer.valueOf(res);
  •  Tags:  
  • Related