11. Outgoing data
GET /api/users
• GET /api/users/12
• GET /api/users ?loginMask=rmel&createdAfter=2012-12-12
POST /api/users
• POST /api/users/12
PUT /api/users/12
• PUT /api/users ← sure to do this?
DELETE /api/users/12
• DELETE /api/users ← DONT EVEN TRY!!!1111
12. Outgoing data
POST and PUT require data:
• Content-Type:
◦application/json
◦application/xml
◦multipart/form-data
◦text/plain
◦text/html
◦text/xml
13. Incoming data
Response code:
• 2xx
• 4xx
◦400 Bad Request, 405 Method not allowed
◦401 GTFO Unauthorized
◦403 Forbidden
• 5xx
17. Incoming data
@GET
@Path("api/users/{id}")
@Produces("application/json")
public User getUserInfo(
@PathParam("id") String uid,
@QueryParam("filter") String filter
) throws ApiException;
18. “Always code
as If the guy who ends up
maintaining your code
will be a violent psychopath
who knows where you live.
— Martin Golding
19. Spend some time
http://www.restapitutorial.com/
http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
http://www.iana.org/assignments/http-status-codes/http-status-codes.
xhtml