Recently viewed pages
This code is from Drupal 9 back-end for a React front-end via REST API.
Working through the output for recently viewed pages... the code structure:
How to use the Poll module and passing via RESTful API
Using the Drupal Poll module and passing via RESTful API - How do you get it working?
The initial set-up
POST: {domain}/mhc_custom/poll?_format=json
Content-type: application/json
Accept: application/json
{
"choice": "1"
}
If you run the above credentials, you will find the following response
How to recover or change or reset your password using REST
How to use the Drupal REST API to trigger I've forgot (need to change) my password.
POST: {domain}/user/password?_format=hal_json
Content-type: application/hal_json
Accept: application/hal+json
Or if you are using hal_json then use
POST: {domain}/user/password?_format=json
Content-type: application/json
Accept: application/json
Body
Drupal REST how to get an image
In retrieving an image, the primary element required is:
- File id or fid;
Query string
Using the element outlined above the query string becomes:
{domain}/file/{fid}/?_format=hal_json
Replacing the following variables:
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:
Drupal get a vocabulary list using REST API
For an introduction to setting up RESTful hal+json refer to the set-up documentation. This article is about retrieving vocabulary lists that are used in many of the requests such as:
User options - login, logout and user details
For an introduction into setting up RESTful hal+json refer to the set-up documentation. Also see the Query - user screen.