-
Notifications
You must be signed in to change notification settings - Fork 9
base
hantsy edited this page Dec 9, 2015
·
1 revision
I have created several sample applications to demonstrate different backend solutions for producing REST API.
In this post, I will create the REST API using JAXRS which is part of Java EE platform. On different application servers, the JAXRS implementation is different. Jersey is the official reference implementation which is shipped with Glassfish by default, and Resteasy is the JBoss alternative JAXRS implementation on JBoss platform(Jboss AS has been named to Wildfly).
REST API design should embrace the HTTP verbs, for example.
URI | HTTP METHOD | REQUEST | RESPONSE/HTTP STATUS | DESCRIPTION |
---|---|---|---|---|
/posts | GET | 200, [{'id':1, 'title':'my first post'}, {}] | Get all posts | |
/posts | POST | { 'title':'my first post'} | 201 | Creat a post |
/posts/{id} | GET | 200, {'id':1, 'title':'my first post'} | Get post by id | |
/posts/{id} | PUT | { 'title':'my first post'} | 205 | Update the post by id |
/posts/{id} | DELETE | 205 | Delete the post by id |