Curd functions are synonymous of modifying the information in the database world. If you have heard the CRUD before. It means create, Read, Update & delete. Level 2 of Richardson maturity level is about matching services with their HTTP Verbs. CRUD functions are mapped to their HTTP equivalents. So, we use
Often times, people will use POST for Create and Update because of return types PUT allows.
JSON
To use JSON all we have to do to annotate our method Produces like
@Produces(MediaType.APPLICATION_JSON)
It tells us that application is producing JSON
XML
@Produces(MediaType.APPLICATION_XML)
Binary
Binary is not necessarily an alternative to JSON or XML
It is used to serve objects. e.g.,
Files
Images
PDFs
Here I does mean JAVA objects, binary things we normally serves statically or that are stored in your database. To use binary we annotate our method Produces like
@Produces(MediaType.APPLICATION_OCTET_STREAM)