requests.http

Overview

This file contains a collection of HTTP request examples primarily designed for testing or interacting with message-related REST API endpoints across different API versions and hosts. The requests focus on the POST method to submit messages to various /messages endpoints, showcasing typical payloads, headers, and authentication schemes. The file also includes examples of valid and intentionally malformed requests to demonstrate different server responses, such as successful message creation and bad requests.

Request Definitions

Variables

Requests

1. POST to /v1/messages

POST http://localhost/v1/messages HTTP/1.1
Content-Type: application/json

{}

2. POST to /v2/messages

POST http://localhost/v2/messages HTTP/1.1
Content-Type: application/json

{}

3. Bad Request Example

4. Valid POST to /bm/v2/messages on port 8700

POST http://localhost:8700/bm/v2/messages HTTP/1.1
Content-Type: application/json

[{
    "id":"ee4ca4f6ddb38b572f118d9d5d564fe0960fc0fe3a29737ff8e8713bf329db69",
    "body":"te6ccgEBAwEArAAB5YgAIiI...",
    "expire_at":null,
    "thread_id":"00000000000000000000000000000000000000000000000000000000000000000000",
    "bm_pubkey":null,
    "ext_message_token":null
}]

5. Authenticated POST to /bk/v2/messages on port 11003

POST http://localhost:11003/bk/v2/messages HTTP/1.1
Content-Type: application/json
Authorization: Bearer my-secret-token

[{
    "id": "4d5772b75a413327386aabf4bfb53acd58279c26b19dea5d8325a635fc7c3aee",
    "body": "te6ccgEBAwEArAAB5YgAIiI...",
    "expire_at": null,
    "thread_id": "00000000000000000000000000000000000000000000000000000000000000000000",
    "bm_pubkey": null,
    "ext_message_token": null
}]

Important Implementation Details

Interaction with Other System Components

Visual Diagram

flowchart TD
A[Start] --> B[POST /v1/messages]
A --> C[POST /v2/messages]
A --> D[POST /bm/v2/messages on port 8700]
A --> E[POST /bk/v2/messages on port 11003]
A --> F[POST /bm/v2/messages Bad Request]
B --> G{Empty JSON body}
C --> G
D --> H{Valid message payload}
E --> I{Valid message payload + Auth}
F --> J{Invalid message payload}
style B fill:#bbdefb,stroke:#1e88e5
style C fill:#bbdefb,stroke:#1e88e5
style D fill:#c8e6c9,stroke:#388e3c
style E fill:#c8e6c9,stroke:#388e3c
style F fill:#ffcdd2,stroke:#d32f2f