【问题标题】:Passing GET parameter to a weird URL pattern (RetroFit 1.9)将 GET 参数传递给一个奇怪的 URL 模式 (RetroFit 1.9)
【发布时间】:2016-10-22 14:16:15
【问题描述】:

请原谅标题;我不知道如何描述这个问题:

我有一个 REST 服务 URL,如下所示:

@GET("/ProfileData/CustomerDetails('1234')?$format=json")
CustomerDetailsResponse getContactDetails();

这里,“1234”是客户的 ID,我需要在 getContactDetails() 中传递它。

我将如何使用 RetroFit 1.9 来解决这个问题? (目前还不能更新到 2.0)。

【问题讨论】:

    标签: android rest get retrofit


    【解决方案1】:

    由于提供的细节很少,我无法理解您的问题 如果你以这种方式传递你的价值观会很好

    @GET("/ProfileData/CustomerDetails?id=1234?format=json")
    Call<enter> getvalue(@Query("id")String id ,@Query("json") String json)`
    

    对于显示值,您可以从此代码中获取帮助

    Call<Student> call = service.getDetails();
    
    
    call.enqueue(new Callback<Student>() {
        @Override
        public void onResponse(Response<Student> response, Retrofit retrofit) {
    
            try {
                 String check;
                text_status_1.setText("StudentId  :  " + response.body().getC_name());
                         //text_status_1.setText("Status  :  " + StudentData.get(i). getC_name());
                         //text_city_2.setText("city  : " + StudentData.get(i).getCity());
                           check=response.body().getStatus();
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-11
      • 2016-02-23
      • 1970-01-01
      • 1970-01-01
      • 2012-07-08
      • 2018-12-10
      • 2015-02-12
      相关资源
      最近更新 更多