Andrew Fletcher published: 19 May 2022 1 minute read
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:
- URL - your-site.com/node/<nid>?_format=hal_json;
- Content-Type - application/hal+json;
- Nod.nid - noted in the URL string as <nid>.
Example using a node.nid of one (1). So the nid in the URL is <nid> = 1
your-site.com/node/1?_format=hal_jsonThis get on the staging site will output the following:
{
"nid":[{"value":"1"}],
"uuid":[{"value":"c5ab1e63-0b72-4325-bfe6-5c77d3a7acd4"}],
"vid":[{"value":"1"}],
"langcode":[{"value":"en"}],
"type":[{"target_id":"page","target_type":"node_type","target_uuid":"078109da-c606-4810-b684-d3c059eb3aab"}],
"title":[{"value":"Posting to your site using REST API"}],
"uid":[{"target_id":"2","target_type":"user","target_uuid":"f000c9a3-82b2-4ef7-92bb-786f00863c66","url":"\/user\/2"}],
"status":[{"value":"1"}],
"created":[{"value":"1467305369"}],
"changed":[{"value":"1467305390"}],
"promote":[{"value":"0"}],
"sticky":[{"value":"0"}],
"revision_timestamp":[{"value":"1467305390"}],
"revision_uid":[{"target_id":"2","target_type":"user","target_uuid":"f000c9a3-82b2-4ef7-92bb-786f00863c66","url":"\/user\/2"}],
"revision_log":[],
"revision_translation_affected":[{"value":"1"}],
"default_langcode":[{"value":"1"}],
"path":[],
"body":[{"value":"<p>Lear how to POST via REST to Drupal your site.<\/p>\r\n","format":"basic_html","summary":""}]
}
Testing through Chrome
Using the Chrome extension DHC, enter the parameters noted above as a means of cross checking and testing.
Related articles
Andrew Fletcher
•
09 Jan 2026
Upgrading Drupal from 10.6.x to 11.3.2: a practical, dependency-driven walkthrough
Upgrading from Drupal 10.6.x to 11.3.x is officially supported, but in real projects it’s rarely a single command. The friction usually comes from **Composer constraints**, not Drupal itself.This article documents a real-world upgrade path from Drupal 10.6.1 → 11.3.2, including the specific blockers...
Andrew Fletcher
•
04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher
•
26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...