Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drupal JSON API example
{
"data": [
{
"type": "node--article",
"id": "3c38f39b-6601-41bd-a205-5e30c42c36fb",
"attributes": {
"nid": "1",
"uuid": "3c38f39b-6601-41bd-a205-5e30c42c36fb",
"vid": "1",
"langcode": "en",
"title": "Rocky Coastline",
"status": "1",
"created": "1456889422",
"changed": "1456891222",
"promote": "1",
"sticky": "0",
"revision_timestamp": "1456889466",
"revision_log": null,
"revision_translation_affected": "1",
"default_langcode": "1",
"path": null,
"publish_on": null,
"unpublish_on": null,
"body": {
"value": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum placerat nisl ut eros pharetra, eget commodo lacus elementum. Donec ac lectus purus. Nullam elit sem, accumsan in consequat ut, pretium et ex. Aliquam elementum auctor porta. Aliquam vitae ipsum sollicitudin, suscipit massa id, interdum tortor. Nam sit amet arcu malesuada, commodo magna id, cursus est. Donec laoreet ipsum et nunc suscipit, ut facilisis odio auctor. Cras euismod enim nec tempor porta. Proin volutpat lorem non felis maximus ullamcorper. Mauris erat diam, convallis eget risus vitae, volutpat ornare risus. Proin cursus bibendum orci, id varius ligula tincidunt at. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ultricies tellus nec justo sagittis, eget ultricies neque laoreet. Nam eget vehicula augue.</p>\r\n\r\n<p><br />\r\nNulla aliquam semper mattis. Sed vestibulum, sapien id porttitor vehicula, dolor metus interdum erat, tristique efficitur nulla ligula et massa. Phasellus eu urna nulla. Integer lobortis sapien nec fringilla tempus. Maecenas vestibulum vehicula eros, at mollis tortor sollicitudin quis. Nulla accumsan nibh nec nulla luctus vulputate. Etiam cursus aliquam neque at blandit. Suspendisse ultricies feugiat massa ut efficitur. Aenean mollis at nulla id rhoncus. Aliquam dolor eros, imperdiet eget leo quis, gravida dapibus lorem. Nam id orci ac dolor congue interdum ac eu justo.</p>\r\n\r\n<p><br />\r\nInteger pretium ut erat et facilisis. Morbi dapibus nulla eu tristique mollis. Fusce lectus nunc, porta sit amet molestie quis, egestas nec purus. Praesent at ex iaculis, pellentesque libero sit amet, ullamcorper elit. Quisque quis lacus in massa sollicitudin placerat. Mauris dictum tincidunt eros quis consectetur. Quisque vehicula enim nisl, sit amet ultricies felis iaculis ac. Sed dignissim pulvinar eros. Curabitur gravida velit eget ultrices malesuada. Curabitur ac sapien bibendum, eleifend massa vel, cursus massa. Integer placerat nisi in pharetra accumsan. Vivamus in blandit ante. Morbi ac hendrerit metus. Sed condimentum justo vel maximus pretium.<br />\r\n&nbsp;</p>\r\n",
"format": "basic_html",
"summary": ""
},
"field_link": null,
"field_metatags": null
},
"relationships": {
"type": {
"data": {
"type": "node_type--node_type",
"id": "ee4b1824-d927-4539-b500-d8ee5400e0fb"
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/type?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/type?_format=api_json"
}
},
"uid": {
"data": {
"type": "user--user",
"id": "1a17d256-857c-4409-b703-3b765df5449f"
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/uid?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/uid?_format=api_json"
}
},
"revision_uid": {
"data": {
"type": "user--user",
"id": "ecec299c-5d20-457f-8855-8593d14c5050"
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/revision_uid?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/revision_uid?_format=api_json"
}
},
"moderation_state": {
"data": {
"type": "moderation_state--moderation_state",
"id": "5742dd13-35f1-426c-be5c-27977bc3cf76"
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/moderation_state?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/moderation_state?_format=api_json"
}
},
"menu_link": {
"data": null
},
"field_image": {
"data": {
"type": "file--file",
"id": "3b120ee0-5e4b-4898-8805-5a65c71e0675"
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/field_image?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/field_image?_format=api_json"
}
},
"field_related": {
"data": []
},
"field_tags": {
"data": [
{
"type": "taxonomy_term--tags",
"id": "f5342a8b-60ba-4d9b-bd23-350a64c4f991"
},
{
"type": "taxonomy_term--tags",
"id": "0e8c9d93-04b4-4989-a100-aa99d6616f74"
}
],
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/relationships/field_tags?_format=api_json",
"related": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb/field_tags?_format=api_json"
}
}
},
"links": {
"self": "http://example.com/api/node/article/3c38f39b-6601-41bd-a205-5e30c42c36fb?_format=api_json"
}
},
],
"links": {
"self": "http://example.com/api/node/article?_format=api_json&include=field_image"
},
"included": [
{
"data": {
"type": "file--file",
"id": "3b120ee0-5e4b-4898-8805-5a65c71e0675",
"attributes": {
"fid": "1",
"uuid": "3b120ee0-5e4b-4898-8805-5a65c71e0675",
"langcode": "en",
"filename": "_MG_0237.JPG",
"uri": "public://2016-03/_MG_0237.JPG",
"filemime": "image/jpeg",
"filesize": "906481",
"status": "1",
"created": "1456889466",
"changed": "1456889489",
"url": "/sites/default/files/2016-03/_MG_0237.JPG"
},
"relationships": {
"uid": {
"data": {
"type": "user--user",
"id": "ecec299c-5d20-457f-8855-8593d14c5050"
},
"links": {
"self": "http://example.com/api/file/file/3b120ee0-5e4b-4898-8805-5a65c71e0675/relationships/uid?_format=api_json",
"related": "http://example.com/api/file/file/3b120ee0-5e4b-4898-8805-5a65c71e0675/uid?_format=api_json"
}
}
},
"links": {
"self": "http://example.com/api/file/file/3b120ee0-5e4b-4898-8805-5a65c71e0675?_format=api_json"
}
},
"links": {
"self": "http://example.com/api/node/article?_format=api_json&include=field_image"
}
},
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.