From 90b1a63189c229751ac6f18b87d23fea5714d27c Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Mon, 10 Aug 2026 19:41:54 +0800 Subject: [PATCH] fix(core-api): capture created ids, and create a channel before using it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 17 of 24 requests failed, from three causes. Nothing captured an id. The collection had no afterResponse script anywhere, so {{file_id}}, {{chat_channel_id}}, {{chat_message_id}}, {{chat_participant_id}} and {{comment_id}} were never set and every Retrieve/Update/Delete addressed an unresolved variable. Added captures to the creates that actually succeed. Chat Channels ran in an impossible order. Send Message (2000), Delete Message (3000) and Create Read Receipt (4000) all executed before Create Chat Channel (5000), so they addressed a channel that did not exist yet. Resequenced so the channel is created first and the destructive calls come last — which also reads more sensibly as documentation than sending a message before opening a channel. Create Comment sent an unresolved {{subject_type}}, and the API interpolated it straight into a class name: Target class [\Fleetbase\Models\{{subjectType}}] does not exist. That is a 500 on user input and worth fixing in core-api separately. The collection now posts a real subject, the seeded organization. Left alone: Upload File posts multipart with an empty `src`, so it 422s with "Please select a file to upload". It needs a real file committed to the repo to work at all, which is a different decision — Upload Base64 File already covers the upload path and does succeed. Edited as text rather than round-tripping through the YAML dumper: the dumper reflows descriptions and drops blank lines, which is noise in a repo that is published as API reference. Structure verified with the parser afterwards — 24 requests, 0 invalid, no null pathVariables. Co-Authored-By: Claude Opus 5 --- .../Chat Channels/Add Participant.request.yaml | 9 ++++++++- .../Chat Channels/Create Chat Channel.request.yaml | 9 ++++++++- .../Chat Channels/Create Read Receipt.request.yaml | 2 +- .../Chat Channels/Delete Chat Channel.request.yaml | 2 +- .../Chat Channels/Delete Message.request.yaml | 2 +- .../Chat Channels/Query Chat Channels.request.yaml | 2 +- .../Chat Channels/Remove Participant.request.yaml | 2 +- .../Chat Channels/Retrieve Chat Channel.request.yaml | 2 +- .../Chat Channels/Send Message.request.yaml | 9 ++++++++- .../Chat Channels/Update Chat Channel.request.yaml | 2 +- .../Comments/Create Comment.request.yaml | 11 +++++++++-- .../Files/Upload Base64 File.request.yaml | 7 +++++++ 12 files changed, 47 insertions(+), 12 deletions(-) diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Add Participant.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Add Participant.request.yaml index b9d62fd..c952cce 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Add Participant.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Add Participant.request.yaml @@ -14,4 +14,11 @@ body: "user": "{{user_id}}" } -order: 10000 +scripts: + - type: afterResponse + code: | + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("chat_participant_id", json_response.id); + language: text/javascript +order: 8000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Create Chat Channel.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Create Chat Channel.request.yaml index 1f238a1..3e84794 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Create Chat Channel.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Create Chat Channel.request.yaml @@ -13,4 +13,11 @@ body: ] } -order: 5000 +scripts: + - type: afterResponse + code: | + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("chat_channel_id", json_response.id); + language: text/javascript +order: 2000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Create Read Receipt.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Create Read Receipt.request.yaml index 8a5d35d..2a601a8 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Create Read Receipt.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Create Read Receipt.request.yaml @@ -14,4 +14,4 @@ body: "participant": "{{chat_participant_id}}" } -order: 4000 +order: 4000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Delete Chat Channel.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Delete Chat Channel.request.yaml index c343c7c..03bef66 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Delete Chat Channel.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Delete Chat Channel.request.yaml @@ -7,4 +7,4 @@ pathVariables: - key: id value: "{{chat_channel_id}}" -order: 9000 +order: 11000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Delete Message.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Delete Message.request.yaml index e5f8f80..e08423d 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Delete Message.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Delete Message.request.yaml @@ -7,4 +7,4 @@ pathVariables: - key: chatMessageId value: "{{chat_message_id}}" -order: 3000 +order: 10000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Query Chat Channels.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Query Chat Channels.request.yaml index 31049f7..692c3c0 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Query Chat Channels.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Query Chat Channels.request.yaml @@ -7,4 +7,4 @@ queryParams: limit: "25" offset: "0" sort: "created_at" -order: 7000 +order: 6000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Remove Participant.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Remove Participant.request.yaml index 80f7cf4..8ac3135 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Remove Participant.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Remove Participant.request.yaml @@ -7,4 +7,4 @@ pathVariables: - key: participantId value: "{{chat_participant_id}}" -order: 11000 +order: 9000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Retrieve Chat Channel.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Retrieve Chat Channel.request.yaml index 1bd724a..f216c14 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Retrieve Chat Channel.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Retrieve Chat Channel.request.yaml @@ -7,4 +7,4 @@ pathVariables: - key: id value: "{{chat_channel_id}}" -order: 8000 +order: 7000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Send Message.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Send Message.request.yaml index 892e803..9b35fbb 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Send Message.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Send Message.request.yaml @@ -16,4 +16,11 @@ body: "files": [] } -order: 2000 +scripts: + - type: afterResponse + code: | + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("chat_message_id", json_response.id); + language: text/javascript +order: 3000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Chat Channels/Update Chat Channel.request.yaml b/postman/collections/Fleetbase Core API/Chat Channels/Update Chat Channel.request.yaml index a67469a..0fd4326 100644 --- a/postman/collections/Fleetbase Core API/Chat Channels/Update Chat Channel.request.yaml +++ b/postman/collections/Fleetbase Core API/Chat Channels/Update Chat Channel.request.yaml @@ -14,4 +14,4 @@ body: "name": "Dispatch Updates" } -order: 6000 +order: 5000 \ No newline at end of file diff --git a/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml b/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml index 124ccc0..1b03aba 100644 --- a/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml +++ b/postman/collections/Fleetbase Core API/Comments/Create Comment.request.yaml @@ -9,9 +9,16 @@ body: { "content": "Example comment", "subject": { - "id": "{{subject_id}}", - "type": "{{subject_type}}" + "id": "{{organization_id}}", + "type": "company" } } +scripts: + - type: afterResponse + code: | + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("comment_id", json_response.id); + language: text/javascript order: 1000 diff --git a/postman/collections/Fleetbase Core API/Files/Upload Base64 File.request.yaml b/postman/collections/Fleetbase Core API/Files/Upload Base64 File.request.yaml index 407c22e..6a94a77 100644 --- a/postman/collections/Fleetbase Core API/Files/Upload Base64 File.request.yaml +++ b/postman/collections/Fleetbase Core API/Files/Upload Base64 File.request.yaml @@ -14,4 +14,11 @@ body: "path": "uploads" } +scripts: + - type: afterResponse + code: | + var json_response = pm.response.json(); + let cv = pm.environment; + cv.set("file_id", json_response.id); + language: text/javascript order: 2000