directus / directus/docs

Improve updating multiple items api reference

Open
#257 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
22
Forks
82
Avg merge
18h 49m
Merged PRs (30d)
4

Description

The "Update Multiple Items" section in the API reference is missing 2 supported methods of doing multiple updates.

On this page https://directus.io/docs/api/items#update-multiple-items we are currently documenting the "update many by keys" approach, here you provide a list of `keys` and one single object to update all keys with.
```
PATCH /items/:collection
{
"keys": [1,2,3,4],
"data": {
"status": "published"
}
}
```

We also support the following approaches:
1. "update many by query" similar to the one above but instead of providing a list of ID's you provide a query to filter items to be updated with a single object.
```
PATCH /items/:collection
{
"query": {
"filter": {
"status": { "_eq": "draft" },
},
},
"data": {
"status": "published"
}
}
```
2. "batch updating" this approach allows the sending of a list of items to updated based on ID so each individual item can update different properties.
```
PATCH /items/:collection
[
{
"id": 1,
"status": "published"
},
{
"id": 2,
"status": "archived"
},
{
"id": 3,
"title": "something"
},
]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.