PPD
PPD

Reputation: 5890

End Point in Retrofit URL

in my application using Retrofit. I had declared interface, But I am not sure how to use Endpoint in this url.

my URL is:http://javatechig.com/api/get_category_posts/?dev=1&slug=android

Now my question is how to add endpoint for this url. my interface is like:

public interface Api {

@GET("/WHAT COMES HERE")
void getItem(WHAT_COMES HERE,
                Callback<FeedItem> callback);

}

Any suggestion will be appreciated Thanks in advance

Upvotes: 0

Views: 597

Answers (1)

Tushar Gogna
Tushar Gogna

Reputation: 5083

ENDPOINT is the part of the URL which will be the same for all services URLs (in most cases). Eg: suppose facebook is giving a service, then its ENDPOINT is going to be like "http://www.facebook.com/" and then you can add any request POST/GEt by add "user_name OR page_name" //Just an example.

So what you need to do to set the end point is something like:

END_POINT="http://javatechig.com/api/get_category_posts/";

and then use it like:

Builder builder = new RestAdapter.Builder().setEndpoint(END_POINT);
...
...
@GET("?dev=1&slug=android")

Hope it helps.

Upvotes: 3

Related Questions