android - Uber request error -


i using uber book cab in application. got price list , authenticated access token. after trying book cab using request api.

i included request scope.

this code call request api:

private void bookuber(string selectedproductid,string token,double startlatitude,double startlongitude,             double endlatitude,double endlongitude) {          uberapiclient.getsandbox().getrequest(token, selectedproductid,                 startlatitude, startlongitude, endlatitude, endlongitude,                 new ubercallback<ubermodel>() {                     @override                     public void success(ubermodel ubermodel, response response) {                         super.success(ubermodel, response);                         log.e("ubermodel", ubermodel.tostring());                         log.e("response", "" + response);                     }                      @override                     public void failure(retrofiterror error) {                         log.e("bookuber error ", "" + error);                         super.failure(error);                     }                 });      } 

request method:

 @post("/requests")     void getrequest(@header("authorization") string authtoken,                     @query("product_id") string productid,                     @query("start_latitude") double startlatitude,                     @query("start_longitude") double startlongitude,                     @query("end_latitude") double endlatitude,                     @query("end_longitude") double endlongitude,                     callback<ubermodel> callback); 

this logcat:

06-15 15:26:15.379: d/retrofit(3142): <--- http 406 https://sandbox-api.uber.com/v1/requests?product_id=fbc0033d-5a1a-4f01-964c-0e4ea56b6e7e&start_latitude=13.0497&start_longitude=80.2126&end_latitude=13.0827&end_longitude=80.2707 (2276ms) 06-15 15:26:15.379: d/retrofit(3142): : http/1.1 406 not acceptable 06-15 15:26:15.389: d/retrofit(3142): connection: keep-alive 06-15 15:26:15.389: d/retrofit(3142): content-length: 164 06-15 15:26:15.389: d/retrofit(3142): content-type: application/json 06-15 15:26:15.389: d/retrofit(3142): date: mon, 15 jun 2015 09:56:14 gmt 06-15 15:26:15.389: d/retrofit(3142): server: nginx 06-15 15:26:15.389: d/retrofit(3142): strict-transport-security: max-age=31536000; includesubdomains; preload 06-15 15:26:15.389: d/retrofit(3142): x-android-received-millis: 1434362175394 06-15 15:26:15.389: d/retrofit(3142): x-android-sent-millis: 1434362174535 06-15 15:26:15.389: d/retrofit(3142): x-uber-app: uberex-sandbox 06-15 15:26:15.389: d/retrofit(3142): x-xss-protection: 1; mode=block 06-15 15:26:15.389: d/retrofit(3142): {"message":"only request header `content-type: application\/json` supported endpoint. please check request headers.","code":"invalid_content_type"} 06-15 15:26:15.389: d/retrofit(3142): <--- end http (164-byte body) 06-15 15:26:15.399: e/bookuber error(3142): retrofit.retrofiterror: 406 not acceptable 06-15 15:26:15.399: w/system.err(3142): retrofit.retrofiterror: 406 not acceptable 06-15 15:26:15.409: w/system.err(3142):     @ retrofit.restadapter$resthandler.invokerequest(restadapter.java:388) 06-15 15:26:15.409: w/system.err(3142):     @ retrofit.restadapter$resthandler.access$100(restadapter.java:220) 06-15 15:26:15.409: w/system.err(3142):     @ retrofit.restadapter$resthandler$2.obtainresponse(restadapter.java:278) 06-15 15:26:15.409: w/system.err(3142):     @ retrofit.callbackrunnable.run(callbackrunnable.java:42) 06-15 15:26:15.409: w/system.err(3142):     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1076) 06-15 15:26:15.409: w/system.err(3142):     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:569) 06-15 15:26:15.409: w/system.err(3142):     @ retrofit.platform$android$2$1.run(platform.java:142) 06-15 15:26:15.409: w/system.err(3142):     @ java.lang.thread.run(thread.java:856) 

am miss anything?

thanks in advance!

finally got answer. may useful answer in future. referred this.

i have changed request method:

@post("/requests") void getrequest(@header("authorization") string authtoken,                 @body hashmap<string, string> obj,                 callback<ubermodel> callback); 

method call api:

private void bookuber(string selectedproductid,string token,double startlatitude,double startlongitude,             double endlatitude,double endlongitude) {         hashmap<string, string> obj=new hashmap<string, string>();             obj.put("product_id", selectedproductid);             obj.put("start_latitude", string.valueof(startlatitude));             obj.put("start_longitude", string.valueof(startlongitude));             obj.put("end_latitude", string.valueof(endlatitude));             obj.put("end_longitude", string.valueof(endlongitude));              uberapiclient.getsandbox().getrequest(token, obj,                     new ubercallback<ubermodel>() {                         @override                         public void success(ubermodel ubermodel, response response) {                             super.success(ubermodel, response);                             log.e("response", "" + response.tostring());                         }                          @override                         public void failure(retrofiterror error) {                             log.e("uber price list error ", "" + error);                             super.failure(error);                         }                     });      } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -