- Issue created by @jasonawant
- πΊπΈUnited States jasonawant New Orleans, USA
If using PATCH, the request would include all unchanged values, for example:
curl -X PATCH \ -H 'Content-Type: application/vnd.api+json' \ --user user:password \ https://master-6hplc6fufbi9r9qm4cpm32byiowejoz4.tugboatqa.com/jsonapi/node/recipe/1ccd8b1b-b09b-405c-ad44-e1aadb1bc880 \ -d '{"data":{"id":"1ccd8b1b-b09b-405c-ad44-e1aadb1bc880","type":"node--recipe","attributes":{"field_ingredients":[{"value":"For the pastry:"},{"value":"299g plain flour"},{"value":"140g butter"},{"value":"Cold water"},{"value":"For the filling:"},{"value":"1 onion"},{"value":"2 garlic cloves"},{"value":"Half a courgette"},{"value":"450ml soya milk"},{"value":"500g grated parmesan"},{"value":"2 eggs"},{"value":"200g sun dried tomatoes"},{"value":"100g feta"}]}}}'
Seems like there could be a way to use POST similar to #2996339: Adding a new value to a multi-value relationship field without losing existing data β
So, probably the answer will be the same, but if anything turns out to be specific to Drupal 9, everyone will say "upgrade the site".
- πΊπΈUnited States jasonawant New Orleans, USA
Right, I used that version b/c simplytest.me site was using 9.5 by default.
My use case would be for the latest version.
I changed the version in case its used to filter out issues if that matters.
- Status changed to Fixed
about 1 year ago 1:23pm 10 January 2024 - πΊπΈUnited States jasonawant New Orleans, USA
Based on support from Drupal slack,
https://git.drupalcode.org/project/drupal/-/blob/10.2.x/core/modules/jso....
EntityResource::patchIndividual()
and
EntityResource::updateEntityField()
There isn't a way to target a specific delta of a multivalue field value.
In the scenario I found myself in, which I've concluded is a poor design, was preventing race conditions from an application updating the same resource from different browser tabs. Since posting, my research has lead me to use a different model to ensure operations don't step on each other.
Automatically closed - issue fixed for 2 weeks with no activity.