Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293458

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 293458

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>