Skip to content

Introduce the included extension #1472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions ext/included/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Included Extension

This extension provides a means to embed included resources within the related [resource identifier object](https://jsonapi.org/format/1.1/#document-resource-identifier-objects) instead of the top-level `included` member.

## <a href="#namespace" id="namespace" class="headerlink"></a> Namespace

This extension uses the namespace `included`.

> Note: JSON:API extensions can only introduce new document members using a
> reserved namespace as a prefix.

## <a href="#document-structure" id="document-structure" class="headerlink"></a> Document Structure

A document that supports this extension MAY embed included resources within the related [resource identifier object](https://jsonapi.org/format/1.1/#document-resource-identifier-objects) instead of the top-level `included` member.

This extension adds the following members to related [resource identifier object](https://jsonapi.org/format/1.1/#document-resource-identifier-objects):
* `included:attributes`
* `included:relationships`
* `included:links`

A complete example document with multiple included relationships:

```json
{
"data": {
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON:API paints my bikeshed!"
},
"links": {
"self": "http://example.com/articles/1"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" },
"included:attributes": {
"firstName": "Dan",
"lastName": "Gebhardt",
"twitter": "dgeb"
},
"included:links": {
"self": "http://example.com/people/9"
}
},
"comments": {
"links": {
"self": "http://example.com/articles/1/relationships/comments",
"related": "http://example.com/articles/1/comments"
},
"data": [
{
"type": "comments",
"id": "5",
"included:attributes": {
"body": "First!"
},
"included:relationships": {
"author": {
"data": { "type": "people", "id": "2" }
}
},
"included:links": {
"self": "http://example.com/comments/5"
}
},
{
"type": "comments",
"id": "12",
"included:attributes": {
"body": "I like XML better"
},
"included:relationships": {
"author": {
"data": { "type": "people", "id": "9" }
}
},
"included:links": {
"self": "http://example.com/comments/12"
}
}
]
}
}
}
}
```




pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy