It’s The Web Services that makes the Drupal so simple and user friendly. But We all know that drupal 8 is been out and everybody is excited about it specially regrading the web services.
It’s Basically the Web services which makes the web applications interactions over the web possible like reading, creating, updating, and deleting of resources.. There Are Several Types of Web services, including:
Drupal sites generally uses REST web Standards but also provides an integrate third-party web services.
REST is most likely the Best ways of making Web Services work. There are other formats also like SOAP or XML-RPC, but here we’ll only going to focus on REST because it’s Drupal standard.
We all Know REST uses basic HTTP requests techniques to obtain and update any data like
GET: Requests to obtain data.
- POST: Requests to update or create data.
- PUT: Requests to update or create data (limited support, currently unused by entity resources).
- PATCH: Requests to update a subset of data, such as one field.
- DELETE: Requests to delete data.
Step 1 – First Step is to Enable enable Restful Web Services and Serialization Module under webservices.
Step 2 – Now 2nd Step is To Grant the permissions which will allow users of your API to send GET To read a resource,POST to create a resource , PATCH to update , and to delete any thing we use delete DELETE.
Step 3 – Final step is to create a view for Application Programming Interface.
- First You need to Create a view with REST Export display
- Then select the particular Format as Serializer and after that in the setting just check the JSON or XML option box or both depending on what you need.
- Now Configure the filter criteria as per your need.
- Now select the path I’ve selected my path as ‘all-content’
- By default this view exposes the whole entity data but if you want more control you can select the fields that you want to show. For e.g you can show just the title of all nodes and nothing else
FOR GET REQUEST:
Here I am using DHC REST API for chrome or you can use Dev HTTP Client to make GET request . Here is a simple get request for example,
FOR POST REQUEST:
We can also do POST requests using the same method. All you need to do is to update the permissons for POST in RESTful Web Services section and that’s it. This is the final result you’ll get
Carmatec is a top mobile app development company in India & USA amid all app development companies. We have top mobile app developers for iPhone/android apps.Our team thrives in every area of mobile app development.