All Types

retrofit2.http.Body

Use this annotation on a service method param when you want to directly control the request body of a POST/PUT request (instead of sending in as request parameters or form-style request body). The object will be serialized using the Retrofit instance Converter and the result will be set directly as the request body.

retrofit2.Call

An invocation of a Retrofit method that sends a request to a webserver and returns a response. Each call yields its own HTTP request and response pair. Use #clone to make multiple calls with the same parameters to the same webserver; this may be used to implement polling or to retry a failed call.

retrofit2.CallAdapter

Adapts a Call with response type R into the type of T. Instances are created by a factory which is into the Retrofit instance.

retrofit2.Callback

Communicates responses from a server or offline requests. One and only one method will be invoked in response to a given request.

retrofit2.Converter

Convert objects to and from their representation in HTTP. Instances are created by which is installed into the Retrofit instance.

retrofit2.http.DELETE

Make a DELETE request.

retrofit2.internal.EverythingIsNonNull

Extends ParametersAreNonnullByDefault to also apply to Method results and fields.

retrofit2.http.Field

Named pair for a form-encoded request.

retrofit2.http.FieldMap

Named key/value pairs for a form-encoded request.

retrofit2.http.FormUrlEncoded

Denotes that the request body will use form URL encoding. Fields should be declared as parameters and annotated with @Field.

retrofit2.http.GET

Make a GET request.

retrofit2.http.HEAD

Make a HEAD request.

retrofit2.http.Header

Replaces the header with the value of its target.


  @GET("/")
  Call<ResponseBody> foo(@Header("Accept-Language") String lang);
  
Header parameters may be null which will omit them from the request. Passing a or array will result in a header for each non-null item.

retrofit2.http.HeaderMap

Adds headers specified in the Map or okhttp3.Headers.

retrofit2.http.Headers

Adds headers literally supplied in the value.


  @Headers("Cache-Control: max-age=640000")
  @GET("/")
  ...
 
  @Headers({
    "X-Foo: Bar",
    "X-Ping: Pong"
  })
  @GET("/")
  ...
  
Note: Headers do not overwrite each other. All headers with the same name will be included in the request.

retrofit2.http.HTTP

Use a custom HTTP verb for a request.


  interface Service {
    @HTTP(method = "CUSTOM", path = "custom/endpoint/")
    Call<ResponseBody> customEndpoint();
  }
  
This annotation can also used for sending DELETE with a request body:

  interface Service {
    @HTTP(method = "DELETE", path = "remove/", hasBody = true)
    Call<ResponseBody> deleteObject(@Body RequestBody object);
  }
  

retrofit2.HttpException

Exception for an unexpected, non-2xx HTTP response.

retrofit2.Invocation

A single invocation of a Retrofit service interface method. This class captures both the method that was called and the arguments to the method.

retrofit2.http.Multipart

Denotes that the request body is multi-part. Parts should be declared as parameters and annotated with @Part.

retrofit2.http.OPTIONS

Make an OPTIONS request.

retrofit2.http.Part

Denotes a single part of a multi-part request.

retrofit2.http.PartMap

Denotes name and value parts of a multi-part request.

retrofit2.http.PATCH

Make a PATCH request.

retrofit2.http.Path

Named replacement in a URL path segment. Values are converted to strings using (or Object#toString(), if no matching string converter is installed) and then URL encoded.

retrofit2.http.POST

Make a POST request.

retrofit2.http.PUT

Make a PUT request.

retrofit2.http.Query

Query parameter appended to the URL.

retrofit2.http.QueryMap

Query parameter keys and values appended to the URL.

retrofit2.http.QueryName

Query parameter appended to the URL that has no value.

retrofit2.Response

An HTTP response.

retrofit2.Retrofit

Retrofit adapts a Java interface to HTTP calls by using annotations on the declared methods to define how requests are made. Create instances using the builder and pass your interface to #create to generate an implementation.

retrofit2.SkipCallbackExecutor

Change the behavior of a Call<BodyType> return type to not use the for invoking the onResponse or onFailure methods.


  @SkipCallbackExecutor
  @GET("user/{id}/token")
  Call<String> getToken(@Path("id") long id);
  
This annotation can also be used when a CallAdapter.Factory explicitly delegates to the built-in factory for Call via Retrofit#nextCallAdapter(CallAdapter.Factory, * Type, Annotation[]) in order for the returned Call to skip the executor. (Note: by default, a Call supplied directly to a CallAdapter will already skip the callback executor. The annotation is only useful when looking up the built-in adapter.)

retrofit2.http.Streaming

Treat the response body on methods returning ResponseBody as is, i.e. without converting the body to byte[].

retrofit2.http.Tag

Adds the argument instance as a request tag using the type as the key.


  @GET("/")
  Call<ResponseBody> foo(@Tag String tag);
  
Tag arguments may be null which will omit them from the request. Passing a parameterized type such as List<String> will use the raw type (i.e., List.class) as the key. Duplicate tag types are not allowed.

retrofit2.http.Url

URL resolved against the base URL.


  @GET
  Call<ResponseBody> list(@Url String url);