简体   繁体   中英

how to do a @GET in RXJava in android

I just need to do a @GET for the following endpoint but not sure the syntax, here is my code:

public interface GithubService {
    String SERVICE_ENDPOINT = "https://api.github.com";
    String SERVICE_FUNDS_ENDPOINT = "http://iwg-testapi.azurewebsites.net";


    // this works fine
    @GET("/users/{login}")
    Observable<Github> getUser(@Path("login") String login);

    //here is the problem:
    @GET("/stem/funds")
    Observable<Funds> getFunds(@Path("funds") String login);

}

It's not a RxJava issue but a Retrofit.

I think the issue is on the GET annotation, as you want to use the path param.

@GET("/stem/{funds}") Observable<Funds> getFunds(@Path("funds")

(Notice that I add {} around funds because I want to use it at the path param)

You may want to check the Retrofit documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM