Skip to content

Attributes of relationships #415 #431

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

Closed
Show file tree
Hide file tree
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
19 changes: 10 additions & 9 deletions extensions/jsonpatch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ operations allowed in this top level array.
### Request URLs and Patch Paths <a href="#patch-urls" id="patch-urls" class="headerlink"></a>

The request URL and each Patch operation's `"path"` are complementary and
**MUST** combine to target a particular resource, collection, attribute, or
**MUST** combine to target a particular resource, collection, resource attribute, or
relationship.

If a server supports the Patch extension, it **MUST** allow Patch operations at
Expand Down Expand Up @@ -65,9 +65,9 @@ Accept: application/vnd.api+json; ext=jsonpatch
]
```

### Updating Attributes <a href="#patch-updating-attributes" id="patch-updating-attributes" class="headerlink"></a>
### Updating Resource Attributes <a href="#patch-updating-attributes" id="patch-updating-attributes" class="headerlink"></a>

To update an attribute, perform a `"replace"` operation with the attribute's
To update a resource attribute, perform a `"replace"` operation with the attribute's
name specified by the `"path"`.

For instance, the following request should update just the `src` property of the
Expand Down Expand Up @@ -162,11 +162,12 @@ To add an element to a to-many relationship, request an `"add"` operation that
targets the relationship's URL. Because the operation is targeting the end of a
collection, the `"path"` must end with `"/-"`.

In the following example, the comment with ID `123` is added to the list of
comments for the article with ID `1`:
In the following example, the new reprint with ID `123` is added to the list of
+publications of the article with ID `1` ():


```text
PATCH /articles/1/links/comments
PATCH /articles/1/links/publications
Content-Type: application/vnd.api+json; ext=jsonpatch
Accept: application/vnd.api+json; ext=jsonpatch

Expand All @@ -175,7 +176,7 @@ Accept: application/vnd.api+json; ext=jsonpatch
"op": "add",
"path": "/-",
"value": [
{ "type": "comments", "id": "123" }
{ "type": "magazines", "id": "123", "publication_type": "reprint" }
]
}
]
Expand Down Expand Up @@ -226,8 +227,8 @@ Accept: application/vnd.api+json; ext=jsonpatch
#### 204 No Content <a href="#patch-responses-204" id="patch-responses-204" class="headerlink"></a>

A server **MUST** return a `204 No Content` status code in response to a
successful Patch operation in which the client's current attributes remain up to
date.
successful Patch operation in which the client's current resource attributes
remain up to date.

#### 200 OK <a href="#patch-responses-200" id="patch-responses-200" class="headerlink"></a>

Expand Down
Loading
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