问题描述:

I am creating SNS app and I am using Retrofit API.

So I want to get posts at server, using the @GET annotation in my interface. But continuously an error occurs.

I want to include parameters to authenticate the user, such as token, id etc. After authenticating, I want to have a callback value.

How do I have to write this interface?

网友答案:

here is my blog : beecanvas.com/EFgUPic0

@GET("/server/posts")
    void abcd(Callback<JsonObject> callback);

if you want to use url params

@GET("/server/posts/")
    void abcd(@Query("userid") long Id,
                      Callback<JsonObject> callback);



restRequestHelper.abcd(id , new Callback<JsonObject>() { 
@Override success, failure
})
相关阅读:
Top