Retrofit error URL query string must not have replace block

前端 未结 4 550
北恋
北恋 2021-02-05 04:43

I have this function

      @GET(\"/users?filters[0][field]={param}&filters[0][operator]=equals&filters[0][value]={value}\")
UserDto retrieveUsersByFilte         


        
4条回答
  •  广开言路
    2021-02-05 05:30

    From the JavaDoc:

    Example 1:

    @GET("/friends")
     Call friends(@Query("page") int page);
    

    Calling with foo.friends(1) yields /friends?page=1. Example with null:


    Example 2:

    @GET("/friends")
     Call friends(@Query("group") String group);
    

    Calling with foo.friends(null) yields /friends. Array/Varargs Example:


    Example 3:

    @GET("/friends")
     Call friends(@Query("group") String... groups);
    

    Calling with foo.friends("coworker", "bowling") yields /friends?group=coworker&group=bowling. Parameter names and values are URL encoded by default. Specify encoded=true to change this behavior.


    Example 4:

    @GET("/friends")
     Call friends(@Query(value="group", encoded=true) String group);
    

    Calling with foo.friends("foo+bar")) yields /friends?group=foo+bar.

提交回复
热议问题