superman superman - 10 months ago 85
Java Question

How to define API endpoint for retrofit?

This is my sample URL to the API end point:

Now, how do I create the base URL and define end point for use in Retrofit.

I've created model class for
, and this is how I defined base URL:

public class ApiClient {

public static final String BASE_URL = "";
private static Retrofit retrofit = null;

public static Retrofit getClient() {
if (retrofit==null) {
retrofit = new Retrofit.Builder()
return retrofit;

This is how I tried to define the end point:

public interface ApiInterface {
Call<LuisPojo> getValues(@Query("id") String apiKey);


But how to add the remaining part,
and the search term in the end

start test

Answer Source

Append it in your getValues()

Call<LuisPojo> getValues(@Query("id") String apiKey, @Query("subscription-key") String key, @Query("q") String q);