[regression] Resource and relationship object `self` links can no longer be used for update/delete requests.

Created on 16 April 2019, over 5 years ago
Updated 22 December 2023, about 1 year ago

Per the JSON API documentation:

https://jsonapi.org/format/#crud-updating

A resource can be updated by sending a PATCH request to the URL that represents the resource.

The URL for a resource can be obtained in the self link of the resource object.

This implies to me that when I receive an object in a response (direct fetch or query) I should be able to use the contents of the self link of that object to find the reference to itself used to fetch (GET), update (PATCH) or delete (DELETE) it. I should not need to manually build such a URL or modify the one I was given.

However for revisioned objects (e.g. nodes) the self link contains a query argument, resourceVersion, which is not allowed on PATCH requests.

An example self link currently might look like:

self: {
  href: "http://localhost:8888/jsonapi/node/event/2e92d00c-13a3-4cb9-8f42-a3de32c6319b?resourceVersion=id%3A4066"
}

If I fetch a node via the API, make a change to some data in it and attempt to send it back to the server using the value of self.href the PATCH request will fail with a 400 (Bad Request) with a detail in the errors array reading PATCH requests with a `resourceVersion` query parameter are not supported.

This behavior seems contrary to the specification and intent of providing a self URL.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
JSON API 

Last updated 1 day ago

Created by

🇺🇸United States adamspe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024