Skip to main content

Drupal how to use node GET command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

GET a node

To get the content of the specific node you require the node.nid.  The key information required in the GET query:

Drupal how to use node POST command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

POST command

Following on from the GET command, to post a node to the site (currently staging) is quite quick.  To do so, complete the following:

Request: {domain}/entity/node

Content-Type: application/hal+json

Node PATCH command

For an introduction into setting up RESTful hal+json refer to the set-up documentation.

PATCH command

Following on from the GET command, to patch a node to the site (currently staging) is quite quick.  To be able to PATCH an article, the member needs to have authority to do so.  All members can update their own content.  However, they cannot update any one else's content.

Outline of the details required to make a PATCH:

Drupal REST POST an image

To POST an image is similar to the other posts mentioned on this site.  This article works through the steps to post an image.

To be able to get, patch or post you need to log in the member so you can retrieve their user id (uid).

Calling a query

To POST an image, the details required are:

PHP - sort a multidimensional array

To sort through a multidimensional array seems to be a function that I occasionally call on.  Handy to have referenced here:

Setting up for hal_json RESTful services

The development version of the app database is held on the staging site.  Note all development and testing will be completed on the staging site.

Drupal 9 uses:

  • HAL : Serializes entities using Hypertext Application Language.
  • RESTful Web Services

For testing purposes you can use either of the following Chrome extensions:

  • Postman;
  • DHC

 

RESTful query user - Drupal

The user parameters provides details about a specific user based on the following parameters:

  • User uid;

The output of this query will return user profile data only of the fields containing data.  An example of the data returned includes, but is not limited to the following:

Subscribe to 9.x