Home > Back-end >  Okhttp post can't get the data, to do
Okhttp post can't get the data, to do

Time:03-06

I use post call this interface can get to the data, but can't get in my code number, only get {" code ": 0," the message: "null," data ": {" count" : 0, "data" : []}}



 
The String url="http://58.254.212.142:4080/HRApi/api/attendance/list";//request link \

OkHttpClient client=new OkHttpClient ();
HashMap ParamsMap=new HashMap<> (a);
ParamsMap. Put (" startTime ", "1614896124");
ParamsMap. Put (" endTime ", "1614909624");

FormBody. Builder formBodyBuilder=new FormBody. Builder ();
For (String key: paramsMap keySet ()) {

FormBodyBuilder. Add (key, paramsMap. Get (key));
}
Request the Request=new Request. Builder ()
Url (url)
.post (formBodyBuilder. The build ())
.build();
Call Call=client. NewCall (request);
Call. The enqueue (new Callback () {//Callback

Public void onResponse (Call the Call, the Response Response) throws IOException {

The String result=response. The body (). The String ();

CodePudding user response:

There should be a call is successful, is the caller did not return the correct data