Enabling RESTful web service interfaces in Drupal 8

Matt Glaman
Apr 26, 2018 · 5 min read

Let’s get started!

Thumbnail
Thumbnail
cd /path/to/drupal8
composer require drupal/restui
Thumbnail
Thumbnail
Thumbnail
Thumbnail

Configuration: enabling and modifying endpoints

Thumbnail
Thumbnail
Thumbnail
Thumbnail

Testing it out!

curl http://drupal8.ddev.local/node/1?_format=json
{
"nid": [
{
"value": 1
}
],
"uuid": [
{
"value": "1b92ceda-135e-4d7e-9861-bbe9a3ae1042"
}
],
"title": [
{
"value": "This is so stateless"
}
],
"uid": [
{
"target_id": 1,
"target_type": "user",
"target_uuid": "421f721e-d342-4505-b1b4-57849d480ace",
"url": "\/user\/1"
}
],
"created": [
{
"value": "2018-04-26T02:44:54+00:00",
"format": "Y-m-d\\TH:i:sP"
}
],
"changed": [
{
"value": "2018-04-26T02:45:23+00:00",
"format": "Y-m-d\\TH:i:sP"
}
],
"body": [
{
"value": "\u003Cp\u003EIn my experience, there is no such thing as luck. What?! Hey, Luke! May the Force be with you. What good is a reward if you ain\u0027t around to use it? Besides, attacking that battle station ain\u0027t my idea of courage. It\u0027s more like\u2026suicide.\u003C\/p\u003E\r\n\r\n\u003Cp\u003ERemember, a Jedi can feel the Force flowing through him. The Force is strong with this one. I have you now.\u0026nbsp;\u003Cstrong\u003EHey, Luke!\u003C\/strong\u003E\u003Cem\u003EMay the Force be with you.\u003C\/em\u003E\u0026nbsp;He is here.\u003C\/p\u003E\r\n\r\n\u003Ch2\u003EDon\u0027t be too proud of this technological terror you\u0027ve constructed. The ability to destroy a planet is insignificant next to the power of the Force.\u003C\/h2\u003E\r\n\r\n\u003Cp\u003EDon\u0027t be too proud of this technological terror you\u0027ve constructed. The ability to destroy a planet is insignificant next to the power of the Force. He is here. Ye-ha! Ye-ha! I have traced the Rebel spies to her. Now she is my only link to finding their secret base.\u003C\/p\u003E\r\n",
"format": "full_html",
"processed": "\u003Cp\u003EIn my experience, there is no such thing as luck. What?! Hey, Luke! May the Force be with you. What good is a reward if you ain\u0027t around to use it? Besides, attacking that battle station ain\u0027t my idea of courage. It\u0027s more like\u2026suicide.\u003C\/p\u003E\n\n\u003Cp\u003ERemember, a Jedi can feel the Force flowing through him. The Force is strong with this one. I have you now.\u00a0\u003Cstrong\u003EHey, Luke!\u003C\/strong\u003E\u003Cem\u003EMay the Force be with you.\u003C\/em\u003E\u00a0He is here.\u003C\/p\u003E\n\n\u003Ch2\u003EDon\u0027t be too proud of this technological terror you\u0027ve constructed. The ability to destroy a planet is insignificant next to the power of the Force.\u003C\/h2\u003E\n\n\u003Cp\u003EDon\u0027t be too proud of this technological terror you\u0027ve constructed. The ability to destroy a planet is insignificant next to the power of the Force. He is here. Ye-ha! Ye-ha! I have traced the Rebel spies to her. Now she is my only link to finding their secret base.\u003C\/p\u003E\n",
"summary": ""
}
]
}

Want to know more?

Matt Glaman

Written by

Open source developer, working with Drupal and building Drupal Commerce.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade