Java Code Examples for retrofit2.http.GET

The following are top voted examples for showing how to use retrofit2.http.GET. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: RequestBuilderTest.java   View source code 6 votes vote down vote up
@Test public void getWithEncodedQueryParamMap() {
  class Example {
    @GET("/foo/bar/") //
    Call<ResponseBody> method(@QueryMap(encoded = true) Map<String, Object> query) {
      return null;
    }
  }

  Map<String, Object> params = new LinkedHashMap<>();
  params.put("kit", "k%20t");
  params.put("pi%20ng", "p%20g");

  Request request = buildRequest(Example.class, params);
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/?kit=k%20t&pi%20ng=p%20g");
  assertThat(request.body()).isNull();
}
 
Example 2
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void getWithPathAndQueryHashParam() {
  class Example {
    @GET("/foo/bar/{ping}/") //
    Call<ResponseBody> method(@Path("ping") String ping, @Query("kit") String kit) {
      return null;
    }
  }

  Request request = buildRequest(Example.class, "pong#", "kat#");
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("http://example.com/foo/bar/pong%23/?kit=kat%23");
  assertThat(request.body()).isNull();
}
 
Example 3
Project: GitHub   File: RequestBuilderTest.java   View source code 5 votes vote down vote up
@Test public void getWithJavaUriUrlAbsolute() {
  class Example {
    @GET
    Call<ResponseBody> method(@Url URI url) {
      return null;
    }
  }

  Request request = buildRequest(Example.class, URI.create("https://example2.com/foo/bar/"));
  assertThat(request.method()).isEqualTo("GET");
  assertThat(request.headers().size()).isZero();
  assertThat(request.url().toString()).isEqualTo("https://example2.com/foo/bar/");
  assertThat(request.body()).isNull();
}
 
Example 4
Project: rxweather-android   File: RxWeatherService.java   View source code 5 votes vote down vote up
@GET("forecast.json")
Observable<Weather> getWeather(
        @Query("key") String key,
        @Query("q") String city
);
 
Example 5
Project: LittleLight   File: RetrofitDestinyApiFacade.java   View source code 5 votes vote down vote up
@Headers("X-API-KEY: " + apiKey)
@GET("/Platform/Destiny/{membershipType}/Account/{membershipId}/Character/{characterId}/Inventory")
Call<BungieResponse<DataResponse<CharacterInventory>>> requestCharacterInventory(@Path("membershipType") int membershipType,
                                                                                 @Path("membershipId") String membershipId,
                                                                                 @Path("characterId") String characterId,
                                                                                 @Header("Cookie") String cookie,
                                                                                 @Header("X-CSRF") String xcsrf);
 
Example 6
Project: azure-libraries-for-java   File: JobsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.scheduler.Jobs get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("jobCollectionName") String jobCollectionName, @Path("jobName") String jobName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 7
Project: azure-libraries-for-java   File: NamespacesInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.Namespaces listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 8
Project: REDAndroid   File: ApiService.java   View source code 4 votes vote down vote up
@GET("ajax.php?action=browse")
Single<TorrentSearch> torrentSearch(@Query("searchstr") String search);
 
Example 9
Project: azure-libraries-for-java   File: RecommendedElasticPoolsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.RecommendedElasticPools get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}")
Observable<Response<ResponseBody>> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("recommendedElasticPoolName") String recommendedElasticPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 10
Project: mvvm-template   File: RepoService.java   View source code 4 votes vote down vote up
@NonNull @GET("repos/{owner}/{repo}/releases/{id}")
@Headers("Accept: application/vnd.github.VERSION.full+json")
Single<Release> getRelease(@Path("owner") String owner, @Path("repo") String repo, @Path("id") long id);
 
Example 11
Project: azure-libraries-for-java   File: AppServiceEnvironmentsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServiceEnvironments listMultiRolePoolSkus" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/multiRolePools/default/skus")
Observable<Response<ResponseBody>> listMultiRolePoolSkus(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 12
Project: azure-libraries-for-java   File: VirtualMachineScaleSetsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 13
Project: OpenHub   File: OpenHubService.java   View source code 4 votes vote down vote up
/**
 * get trending languages, update every day
 */
@Headers("Cache-Control: public, max-age=86400")
@NonNull @GET("languages")
Observable<Response<ArrayList<TrendingLanguage>>> getTrendingLanguages();
 
Example 14
Project: azure-libraries-for-java   File: WebSiteManagementClientImpl.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.WebSiteManagementClient listPremierAddOnOffers" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/premieraddonoffers")
Observable<Response<ResponseBody>> listPremierAddOnOffers(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 15
Project: RxJanDan   File: ApiService.java   View source code 4 votes vote down vote up
@GET("/")
Observable<FreshNewsPosts> getBeforeFreshNewsPosts(@Query("oxwlxojflwblxbsapi") String api,
                                                   @Query("include") String inclue,
                                                   @Query("custom_fields") String custom_fields,
                                                   @Query("dev") int dev,
                                                   @Query("page") int page);
 
Example 16
Project: retrofit-metrics   File: TimedCallAdapterFactoryTest.java   View source code 4 votes vote down vote up
@Timed(name = TIMER_NAME)
@GET(".")
Observable<Response<NamedObject>> timed();
 
Example 17
Project: lecrec-android   File: RecordService.java   View source code 4 votes vote down vote up
@GET("records/{record_id}")
Call<Record> getRecord(@Header("Authorization") String token, @Path("record_id") String id);
 
Example 18
Project: azure-libraries-for-java   File: AccountsImpl.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.datalake.analytics.Accounts get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataLakeAnalytics/accounts/{accountName}")
Observable<Response<ResponseBody>> get(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 19
Project: azure-libraries-for-java   File: WebAppsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.WebApps listProcessModulesSlotNext" })
@GET
Observable<Response<ResponseBody>> listProcessModulesSlotNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 20
Project: Rx-Android-Samples   File: GithubApiInterface.java   View source code 4 votes vote down vote up
@GET("/users/{username}/repos")
Call<List<RepositoryResponse>> getRepositories(@Path("username") String username);
 
Example 21
Project: V2I-Traffic-Light-Demonstrator   File: TrafficLightService.java   View source code 4 votes vote down vote up
@GET("json?request=pedestrian")
Call<PojoPedestrianTrafficLight> pedestrianTrafficLightCall(@Query("duration") String greenphasePeriod);
 
Example 22
Project: autorest.java   File: DictionarysImpl.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.bodydictionary.Dictionarys getNullValue" })
@GET("dictionary/nullvalue")
Observable<Response<ResponseBody>> getNullValue();
 
Example 23
Project: AcopioMX   File: RetroService.java   View source code 4 votes vote down vote up
@GET("acopios/")
Observable<List<Acopio>> fetchAcopios();
 
Example 24
Project: MovieGuide   File: TVService.java   View source code 4 votes vote down vote up
@GET("tv/{tv_id}")
Call<TV> tvDetails(
        @Path("tv_id") String id,
        @Query("api_key") String api_key,
        @Query("language") String lang
);
 
Example 25
Project: azure-libraries-for-java   File: DisksInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.Disks list" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks")
Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 26
Project: jira-steps   File: JiraEndPoints.java   View source code 4 votes vote down vote up
@GET("rest/api/2/project?expand=lead,description")
Call<Project[]> getProjects();
 
Example 27
Project: azure-libraries-for-java   File: AppServiceEnvironmentsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServiceEnvironments listMetricDefinitions" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/metricdefinitions")
Observable<Response<ResponseBody>> listMetricDefinitions(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 28
Project: azure-libraries-for-java   File: NamespacesInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.relay.Namespaces listAuthorizationRules" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Relay/namespaces/{namespaceName}/authorizationRules")
Observable<Response<ResponseBody>> listAuthorizationRules(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 29
Project: Show_Chat   File: PeopleService.java   View source code 4 votes vote down vote up
@GET("person/{person_id}")
Call<Person> peopleDetails(
        @Path("person_id") String person_id,
        @Query("api_key") String api_key,
        @Query("language") String lang
);
 
Example 30
Project: azure-libraries-for-java   File: OperationsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cognitiveservices.Operations listNext" })
@GET
Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 31
Project: CXJPadProject   File: BService.java   View source code 4 votes vote down vote up
@GET("/pad/storeDailyend/queryTodayCardsSales/{pagesize}/{currentPage}")
Call<RMResponse<QueryTodayCardsSalesModel>> queryTodayCardsSales(@Path("pagesize") int pageSize, @Path("currentPage") int currentPage);
 
Example 32
Project: autorest.java   File: ArraysImpl.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: fixtures.bodyarray.Arrays getUuidValid" })
@GET("array/prim/uuid/valid")
Observable<Response<ResponseBody>> getUuidValid();
 
Example 33
Project: Tusky   File: MastodonApi.java   View source code 4 votes vote down vote up
@GET("api/v1/statuses/{id}/favourited_by")
Call<List<Account>> statusFavouritedBy(
        @Path("id") String statusId,
        @Query("max_id") String maxId,
        @Query("since_id") String sinceId,
        @Query("limit") Integer limit);
 
Example 34
Project: azure-libraries-for-java   File: WebServicesInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.machinelearning.WebServices listByResourceGroupNext" })
@GET
Observable<Response<ResponseBody>> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 35
Project: azure-libraries-for-java   File: VirtualMachineRunCommandsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineRunCommands list" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands")
Observable<Response<ResponseBody>> list(@Path("location") String location, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
 
Example 36
Project: WatchIt   File: ApiInterface.java   View source code 4 votes vote down vote up
@GET("movie/{movieId}")
Call<MovieDetails> getMovieDetails(@Path("movieId") int movieId, @Query("api_key") String apiKey);
 
Example 37
Project: DMS   File: DMSService.java   View source code 4 votes vote down vote up
@GET("account/student")
Call<Account> loadMyPage();
 
Example 38
Project: DereHelper   File: CharaService.java   View source code 4 votes vote down vote up
@GET("list/char_t")
Observable<List<CharaIndex>> getCharaIndex();
 
Example 39
Project: FakeWeather   File: WeatherController.java   View source code 4 votes vote down vote up
@GET("https://free-api.heweather.com/v5/weather")
Observable<BaseWeatherResponse<HeWeather5>> getWeather(@Query("key") String key, @Query("city") String city);
 
Example 40
Project: azure-libraries-for-java   File: JobsInner.java   View source code 4 votes vote down vote up
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.batchai.Jobs listNext" })
@GET
Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);