Skip to main content

HTTP method annotations

The following HTTP method annotations are available:

AnnotationHTTP MethodTypical Use Case
@GETGETRetrieving resources
@POSTPOSTCreating resources
@PUTPUTReplacing resources
@PATCHPATCHPartial updates
@DELETEDELETERemoving resources

Each annotation requires a path parameter:

@GET("/users")           // List users
@GET("/users/{id}") // Get user by ID
@POST("/users") // Create user
@PUT("/users/{id}") // Replace user
@PATCH("/users/{id}") // Update user
@DELETE("/users/{id}") // Delete user