【问题标题】:How to make retrofit query parameter request without key name如何在没有键名的情况下进行改造查询参数请求
【发布时间】:2018-12-27 21:51:28
【问题描述】:

我正在使用谷歌自动完成网络服务。我想打电话给

https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=Amoeba&types=establishment&location=37.76999,-122.44696&radius=500&strictbounds&key=YOUR_API_KEY

但 strictbounds 参数没有参数名称。我已创建改造请求,但无法添加 strictbounds 参数

  @GET("maps/api/place/autocomplete/json")
    Call<PlaceSearchResult> searchPlaceByName(@Query("input") String input, @Query("location") String location
            , @Query("radius") String radius, @Query("key") String key);

如何在没有key的情况下添加参数?

【问题讨论】:

  • 你必须在地图中传递这个查询
  • 您忘记在改造请求中输入查询
  • 我也尝试使用地图,但在地图中,我输入的密钥来自 url。 strictbounds 没有任何键
  • 你试过这种方式吗@GET("maps/api/place/autocomplete/json?strictbounds")

标签: android retrofit2


【解决方案1】:

改成这样:

@GET("maps/api/place/autocomplete/json?strictbounds")
Call<PlaceSearchResult> searchPlaceByName(@Query("input") String input, @Query("location") String location
            , @Query("radius") String radius, @Query("key") String key);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-30
    • 1970-01-01
    • 2018-03-17
    • 1970-01-01
    • 2011-12-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多