Update Bulk Update Books.bru to demonstrate tag and contributor updates: - Add tags update example with normalized output - Add contributors update example - Shows punctuation preference behavior Demonstrates that tags and contributors are automatically normalized when updated via bulk operations, ensuring consistency across the database. Relates to Tags & Contributors Migration documentation updates
53 lines
1.4 KiB
Plaintext
53 lines
1.4 KiB
Plaintext
{
|
|
"meta": {
|
|
"name": "Bulk Update Books",
|
|
"type": "http",
|
|
"event": [
|
|
{
|
|
"listen": "test",
|
|
"script": {
|
|
"exec": [
|
|
"// Test bulk update response",
|
|
"if (response.status === 200) {",
|
|
" tests['Bulk update successful'] = true;",
|
|
" const body = JSON.parse(response.body);",
|
|
" tests['Has results array'] = Array.isArray(body.results);",
|
|
" tests['Has total count'] = body.total !== undefined;",
|
|
" tests['Has success count'] = body.success !== undefined;",
|
|
"} else {",
|
|
" tests['Bulk update failed'] = false;",
|
|
"}"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"req": {
|
|
"url": "{{baseUrl}}/api/books/bulk-update",
|
|
"method": "POST",
|
|
"headers": {
|
|
"Content-Type": "application/json",
|
|
"Authorization": "Bearer {{authToken}}"
|
|
},
|
|
"body": {
|
|
"updates": [
|
|
{
|
|
"book_id": "{{bookId1}}",
|
|
"updates": {
|
|
"title": "Updated Title",
|
|
"genre": "Science Fiction",
|
|
"tags": ["science fiction", "non-fiction", "ACME CORP."]
|
|
}
|
|
},
|
|
{
|
|
"book_id": "{{bookId2}}",
|
|
"updates": {
|
|
"author": "Updated Author",
|
|
"contributors": ["O'Reilly Media", "Penguin Random House"]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|