refactor: restructure Bruno API collection for consistency

Standardize all Bruno API request files with consistent formatting and
structure to improve maintainability and readability.

Changes include:
- Consolidate URL parameters into main URL instead of separate definitions
- Standardize quote style (double quotes throughout)
- Add proper settings section with defaults (timeout, redirects, etc.)
- Improve YAML formatting with literal style for multi-line content
- Remove redundant fields (disabled: false)
- Clean up header and body structure
- Update sequence numbers for better organization
- Add scenarios folder structure for organized test groupings

Removes obsolete Search Invalid Library ID test case.

Environment configuration updated with new library_id for testing.

These changes improve the Bruno collection's maintainability and make
it easier to create new API requests following established patterns.
This commit is contained in:
2026-03-25 18:03:00 -04:00
parent 8cc593af99
commit 74009f66b5
24 changed files with 229 additions and 254 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ variables:
- name: note_id
value: 7710a602-g29b-61d4-c716-446655440002
- name: library_id
value: 849151fb-564e-4b24-89e3-d11360789576
value: 87a6114a-186e-4cf6-bb56-aeb16f5f62a8
- name: job_id
value: 295654b3-eb4b-4e85-ac6c-9361c5821195
- name: rating
@@ -5,36 +5,29 @@ info:
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&q=foundation&author_filter=asimov&genre_filter=scifi&year_min=1950&year_max=2000&sort=title ASC"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: q
value: "foundation"
value: foundation
type: query
disabled: false
- name: author_filter
value: "asimov"
value: asimov
type: query
disabled: false
- name: genre_filter
value: "scifi"
value: scifi
type: query
disabled: false
- name: year_min
value: "1950"
type: query
disabled: false
- name: year_max
value: "2000"
type: query
disabled: false
- name: sort
value: "title ASC"
value: title ASC
type: query
disabled: false
auth: inherit
settings:
+19 -9
View File
@@ -1,22 +1,32 @@
info:
name: Create Media Item
type: http
seq: 1
seq: 2
http:
method: POST
url: '{{base_url}}/api/media-items'
auth: inherit
url: "{{base_url}}/api/media-items"
headers:
- name: ""
value: application/json
body:
type: json
jsonBody: '"library_id": "{{library_id'
headers:
- key: Content-Type
value: application/json
data: ""
auth: inherit
runtime:
scripts:
- type: tests
code: "test_create_media_item_success(status, headers, body) {\n if (status\
\ !== 201) {\n throw new Error(\"Expected status 201, got \" + status);"
code: |-
test_create_media_item_success(status, headers, body) {
if (status !== 201) {
throw new Error("Expected status 201, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Create Media Item
+14 -7
View File
@@ -1,17 +1,24 @@
info:
name: Create Media Rating
type: http
seq: 1
seq: 3
http:
method: POST
url: '{{base_url}}/api/media-items/{{media_item_id}}/rating'
auth: inherit
url: "{{base_url}}/api/media-items/{{media_item_id}}/rating"
headers:
- name: ""
value: application/json
body:
type: json
jsonBody: "{\n \"rating\": 8"
headers:
- key: Content-Type
value: application/json
data: ""
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Create Media Rating
+16 -8
View File
@@ -1,21 +1,29 @@
info:
name: Delete Media Item
type: http
seq: 3
seq: 17
http:
method: DELETE
url: '{{base_url}}/api/media-items/{{media_item_id}}'
auth: inherit
body:
type: none
url: "{{base_url}}/api/media-items/{{media_item_id}}"
headers:
- key: Content-Type
- name: ""
value: application/json
auth: inherit
runtime:
scripts:
- type: tests
code: "test_delete_media_item_success(status, headers, body) {\n if (status\
\ !== 204) {\n throw new Error(\"Expected status 204, got \" + status);"
code: |-
test_delete_media_item_success(status, headers, body) {
if (status !== 204) {
throw new Error("Expected status 204, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Delete Media Item
+16 -8
View File
@@ -1,21 +1,29 @@
info:
name: Delete Media Rating
type: http
seq: 5
seq: 19
http:
method: DELETE
url: '{{base_url}}/api/media-items/{{media_item_id}}/rating'
auth: inherit
body:
type: none
url: "{{base_url}}/api/media-items/{{media_item_id}}/rating"
headers:
- key: Content-Type
- name: ""
value: application/json
auth: inherit
runtime:
scripts:
- type: tests
code: "test_delete_media_rating_success(status, headers, body) {\n if (status\
\ !== 204) {\n throw new Error(\"Expected status 204, got \" + status);"
code: |-
test_delete_media_rating_success(status, headers, body) {
if (status !== 204) {
throw new Error("Expected status 204, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Delete Media Rating
+9 -5
View File
@@ -1,13 +1,17 @@
info:
name: Download Media Item
type: http
seq: 1
seq: 4
http:
method: GET
url: '{{baseURL}}/api/media-items/{{bookUUID}}/download'
auth: none
body:
type: none
url: "{{base_url}}/api/media-items/{{media_item_id}}/download"
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Download Media Item
@@ -1,20 +1,18 @@
info:
name: Exact Match With Quotes
type: http
seq: 1
seq: 5
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: '{{base_url}}/api/media-items/search?library_id={{library_id}}&q="Foundation and Empire"'
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: q
value: "\"Foundation and Empire\""
value: '"Foundation and Empire"'
type: query
disabled: false
auth: inherit
settings:
@@ -1,24 +1,21 @@
info:
name: Field Values Search - Authors
type: http
seq: 1
seq: 6
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&author=asimov&limit=50"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: author
value: "asimov"
value: asimov
type: query
disabled: false
- name: limit
value: "50"
type: query
disabled: false
auth: inherit
settings:
@@ -1,24 +1,21 @@
info:
name: Field Values Search - Genres
type: http
seq: 1
seq: 7
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&genre=sci&limit=50"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: genre
value: "sci"
value: sci
type: query
disabled: false
- name: limit
value: "50"
type: query
disabled: false
auth: inherit
settings:
@@ -1,24 +1,21 @@
info:
name: Field Values Search - Languages
type: http
seq: 1
seq: 8
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&language=eng&limit=50"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: language
value: "eng"
value: eng
type: query
disabled: false
- name: limit
value: "50"
type: query
disabled: false
auth: inherit
settings:
@@ -1,24 +1,21 @@
info:
name: Field Values Search - Series
type: http
seq: 1
seq: 9
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&series=foundation&limit=50"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: series
value: "foundation"
value: foundation
type: query
disabled: false
- name: limit
value: "50"
type: query
disabled: false
auth: inherit
settings:
+3 -5
View File
@@ -1,20 +1,18 @@
info:
name: Fuzzy Author Filter
type: http
seq: 1
seq: 10
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&author_filter=Conan"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: author_filter
value: "asimov"
value: Conan
type: query
disabled: false
auth: inherit
settings:
+3 -5
View File
@@ -1,20 +1,18 @@
info:
name: Fuzzy Genre Filter
type: http
seq: 1
seq: 11
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&genre_filter=scifi"
params:
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: genre_filter
value: "scifi"
value: scifi
type: query
disabled: false
auth: inherit
settings:
+16 -6
View File
@@ -1,19 +1,29 @@
info:
name: Get Media Item
type: http
seq: 1
seq: 12
http:
method: GET
url: '{{base_url}}/api/media-items/{{media_item_id}}'
auth: inherit
url: "{{base_url}}/api/media-items/{{media_item_id}}"
headers:
- key: Content-Type
- name: ""
value: application/json
auth: inherit
runtime:
scripts:
- type: tests
code: "test_get_media_item_success(status, headers, body) {\n if (status !==\
\ 200) {\n throw new Error(\"Expected status 200, got \" + status);"
code: |-
test_get_media_item_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Get Media Item
+16 -8
View File
@@ -1,21 +1,29 @@
info:
name: Get Media Rating
type: http
seq: 4
seq: 18
http:
method: GET
url: '{{base_url}}/api/media-items/{{media_item_id}}/rating'
auth: inherit
body:
type: none
url: "{{base_url}}/api/media-items/{{media_item_id}}/rating"
headers:
- key: Content-Type
- name: ""
value: application/json
auth: inherit
runtime:
scripts:
- type: tests
code: "test_get_media_rating_success(status, headers, body) {\n if (status\
\ !== 200) {\n throw new Error(\"Expected status 200, got \" + status);"
code: |-
test_get_media_rating_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Get Media Rating
+4 -7
View File
@@ -1,20 +1,18 @@
info:
name: Search All Libraries
type: http
seq: 1
seq: 13
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?q=foundation&library_id={{library_id}}"
params:
- name: q
value: "foundation"
value: foundation
type: query
disabled: false
- name: library_id
value: "{{library_id}}"
type: query
disabled: false
- name: author_filter
value: ""
type: query
@@ -44,7 +42,7 @@ http:
type: query
disabled: true
- name: sort
value: "title ASC"
value: title ASC
type: query
disabled: true
- name: limit
@@ -218,4 +216,3 @@ docs: |-
2. User-specified sort parameter
3. Title (final fallback)
- Pagination works correctly with limit/offset
@@ -1,54 +0,0 @@
info:
name: Search Invalid Library ID
type: http
seq: 3
http:
method: GET
url: "{{base_url}}/api/media-items/search"
params:
- name: q
value: "test"
type: query
disabled: false
- name: library_id
value: "invalid-uuid"
type: query
disabled: false
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Search Invalid Library ID
Tests error handling when an invalid library_id is provided.
**Method:** GET
**Endpoint:** /api/media-items/search
**Authentication:** Required (Bearer token)
**Query Parameters:**
- `q` (string, required): Search query
- `library_id` (string, invalid): Malformed UUID
**Response:** HTTP 400 (Bad Request)
```json
{
"error": "invalid library_id"
}
```
**Success Criteria:**
- Status: 400
- Returns error message indicating invalid library_id
**Edge Cases Tested:**
- Malformed UUID (not valid UUID format)
- Validates input sanitization
@@ -1,20 +1,18 @@
info:
name: Search Specific Library
type: http
seq: 2
seq: 15
http:
method: GET
url: "{{base_url}}/api/media-items/search"
url: "{{base_url}}/api/media-items/search?q=beo&library_id={{library_id}}"
params:
- name: q
value: "harry"
value: beo
type: query
disabled: false
- name: library_id
value: "{{libraryId}}"
value: "{{library_id}}"
type: query
disabled: false
auth: inherit
settings:
+19 -33
View File
@@ -1,46 +1,32 @@
info:
name: Update Media Item
type: http
seq: 2
seq: 16
http:
method: PUT
url: '{{base_url}}/api/media-items/{{media_item_id}}'
auth: inherit
url: "{{base_url}}/api/media-items/{{media_item_id}}"
headers:
- name: ""
value: application/json
body:
type: json
json:
title: Updated Media Item Title
author: Updated Author Name
isbn: 978-9876543210
description: Updated description
cover_image_path: /updated/path/to/cover.jpg
series: Updated Series Name
series_number: 2
tags:
- updated
- fiction
- adventure
asin: B09XYZ789
date_published: '2023-02-20'
publisher: Updated Publisher
contributors:
- Updated Contributor
language: en
edition: Updated Edition
page_count: 400
genre: Updated Genre
copyright_year: 2023
goodreads_id: '7890123'
openlibrary_id: OL789012M
google_books_id: GB789012
headers:
- key: Content-Type
value: application/json
data: ""
auth: inherit
runtime:
scripts:
- type: tests
code: "test_update_media_item_success(status, headers, body) {\n if (status\
\ !== 200) {\n throw new Error(\"Expected status 200, got \" + status);"
code: |-
test_update_media_item_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Update Media Item
+19 -10
View File
@@ -1,23 +1,32 @@
info:
name: Update Media Rating
type: http
seq: 1
seq: 14
http:
method: PUT
url: '{{base_url}}/api/media-items/{{media_item_id}}/rating'
auth: inherit
url: "{{base_url}}/api/media-items/{{media_item_id}}/rating"
headers:
- name: ""
value: application/json
body:
type: json
jsonBody: "{\n \"rating\": 4,\n \"review\": \"Great book! Very enjoyable\
\ read.\""
headers:
- key: Content-Type
value: application/json
data: ""
auth: inherit
runtime:
scripts:
- type: tests
code: "test_update_media_rating_success(status, headers, body) {\n if (status\
\ !== 200) {\n throw new Error(\"Expected status 200, got \" + status);"
code: |-
test_update_media_rating_success(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, got " + status);
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Update Media Rating
@@ -2,18 +2,20 @@ info:
name: List Media Items
type: http
seq: 1
http:
method: GET
url: '{{base_url}}/api/media-items?library_id={{library_id}}&limit=20&offset=0'
auth: inherit
url: "{{base_url}}/api/media-items?library_id={{library_id}}&limit=20&offset=0"
headers:
- key: Content-Type
- name: ""
value: application/json
runtime:
scripts:
- type: tests
code: "test_list_media_items_success(status, headers, body) {\n if (status\
\ !== 200) {\n throw new Error(\"Expected status 200, got \" + status);"
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## List Media Items
@@ -2,19 +2,20 @@ info:
name: Search Media Items
type: http
seq: 1
http:
method: GET
url: '{{base_url}}/api/media-items/search?q=harry'
auth: inherit
url: "{{base_url}}/api/media-items/search?q=harry"
headers:
- key: Content-Type
- name: ""
value: application/json
runtime:
scripts:
- type: tests
code: "test_search_media_items_success(status, headers, body) {\n if (status\
\ !== 200 && status !== 404) {\n throw new Error(\"Expected status 200\
\ or 404, got \" + status);"
auth: inherit
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
docs: |-
## Search Media Items
+6
View File
@@ -0,0 +1,6 @@
info:
name: scenarios
type: folder
seq: 20
request: {}