我想创建一个可以定位滑板车的应用程序。我正在使用 Bird(Scooter) api。我有一个 Auth 令牌,但是当我想使用 GET 方法发送请求时,它会返回响应代码401,但 auth 令牌不为空。请帮我。API 文档我的请求界面public interface ApiCallsInterface {@Headers({ "Device-id:43ba174c-11f4-4918-9fcc-6d785cfc256e" ,"Platform:android","Content-type:application/json"})@POST("/user/login")Call<AuthResponseClass> getAuthToken(@Body Map<String, String> params);@Headers({ "Device-id:43ba174c-11f4-4918-9fcc-6d785cfc256e", "App-Version:3.0.5"})@GET("/bird/nearby?latitude=37.77184&longitude=-122.40910&radius=1000")Call<BirdResponse> getBirds(@Header("Authorization") String token, @Header("Location") Map<String, String> params);}我如何发送请求Map<String, String> requestParams = new HashMap<>();requestParams.put("latitude",lat);requestParams.put("longitude",lng);requestParams.put("altitude","500");requestParams.put("accuracy","100");requestParams.put("speed","-1");requestParams.put("heading","-1");apiCallsInterface.getBirds(AUTH_TOKEN,requestParams).enqueue(new Callback<BirdResponse>() { @Override public void onResponse(Call<BirdResponse> call, Response<BirdResponse> response) { Log.d(TAG,"" + response.code()); } @Override public void onFailure(Call<BirdResponse> call, Throwable t) { }});
添加回答
举报
0/150
提交
取消