๐Ÿ“ฆ directus / v6-archive

๐Ÿ“„ batch-update-items.md ยท 64 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64# Batch Update Items

> **Note:** Table names are case-sensitive

<span class="request">`PUT` **/api/1.1/tables/_[table-name]_/rows/bulk**</span>

<span class="description">Update multiple items within a specific table</span>

<span class="arguments">Name</span> | Value | Description
--------|-----|------------
**table-name** _String_ | <span class="required">Required</span> | The table that contains the items you wish to update
<span class="custom">**Custom Data**</span> _Array_ | <span class="required">Required</span> | <span class="custom">This data and its architecture is based on your specific project's schema</span>

### Example Request

```javascript
const items = [
  {
    id: 1,
    active: 1,
    title: 'Lorem Ipsum'
  },
  {
    id: 2,
    active: 1,
    title: 'Another Lorem Ipsum'
  }
];

client.updateBulk('projects', items);
```

## Response

<span class="attributes">Attribute</span> | Description
--------|------------
**meta** _Meta Object_ | The Directus system metadata object that provides useful information not contained within the dataset itself [**Meta Object**: View Nested Attributes](/overview/objects-model.md#meta-object)
<span class="custom">**data**</span> _object_ | <span class="custom">This data and its architecture is based on your specific project's schema</span>

### Example Response

```json
{
  "meta": {
    "table": "projects",
    "type": "collection",
    "total": 2,
    "total_entries": 2
  },
  "data": [
    {
      "id": 1,
      "active": 1,
      "title": "Lorem Ipsum"
    },
    {
      "id": 2,
      "active": 1,
      "title": "Another Lorem Ipsum"
    }
  ]
}
```