REST API
REST API
API
API stands for application program interface
3) SOAP can't use REST can use SOAP web services because
REST because it is a it is a concept and can use any protocol
protocol. like HTTP, SOAP.
5) JAX-WS is the java API for JAX-RS is the java API for RESTful web
SOAP web services. services.
6) SOAP defines standards to REST does not define too much standards
be strictly followed. like SOAP.
9) SOAP permits XML data REST permits different data format such
format only. as Plain text, HTML, XML, JSON etc.
10) SOAP is less preferred than REST more preferred than SOAP.
REST.
In HTTP there are five methods that are commonly used in a REST-based
Architecture i.e., POST, GET, PUT, PATCH, and DELETE. These correspond to
create, read, update, and delete (or CRUD) operations respectively. There are other
methods which are less frequently used like OPTIONS and HEAD.
GET: The HTTP GET method is used to read (or retrieve) a representation of a
resource. In the safe path, GET returns a representation in XML or JSON and an
HTTP response code of 200 (OK). In an error case, it most often returns a 404 (NOT
FOUND) or 400 (BAD REQUEST).
POST: The POST verb is most often utilized to create new resources. In particular,
it’s used to create subordinate resources. That is, subordinate to some other (e.g.
parent) resource. On successful creation, return HTTP status 201, returning a
Location header with a link to the newly-created resource with the 201 HTTP status
PUT: It is used for updating the capabilities. However, PUT can also be used to
create a resource in the case where the resource ID is chosen by the client instead
of by the server. In other words, if the PUT is to a URI that contains the value of a
non-existent resource ID. On successful update, return 200 (or 204 if not returning
PATCH: It is used to modify capabilities. The PATCH request only needs to contain
the changes to the resource, not the complete resource. This resembles PUT, but
the body contains a set of instructions describing how a resource currently residing
on the server should be modified to produce a new version. This means that the
PATCH body should not just be a modified part of the resource, but in some kind of
patch language like JSON Patch or XML Patch. PATCH is neither safe nor
idempotent.