Skip to main content

Message Service

Handles creation and retrieval of messages between participants.


Endpoints​


Create Message​

POST /messages

Create a new message.

Request Body​

FieldTypeRequiredDescriptionExample
typeenumYesThe message type (JSON, etc.)"JSON"
dataobjectYesThe message data{ "key": "value" }
participantIdstringYesThe participant identifier"1234abcd-56ef-78gh-90ij-klmnopqrstuv"

Example Request:

{
"type": "JSON",
"data": { "key": "value" },
"participantId": "1234abcd-56ef-78gh-90ij-klmnopqrstuv"
}

Success Response​

Returns the created message object.

{
"id": "msg-789e4567-e89b-12d3-a456-426614174000",
"type": "JSON",
"data": { "key": "value" },
"participantId": "1234abcd-56ef-78gh-90ij-klmnopqrstuv",
"createdAt": "2025-11-20T12:34:56.789Z"
}

Error Responses​

  • 400 Bad Request: Validation failed (missing or invalid fields)

Get All Messages​

GET /messages

Retrieve all messages, optionally filtered by type.

Query Parameters​

ParameterTypeRequiredDescriptionExample
typeenumNoFilter messages by type"JSON"

Example Request:

/messages?type=JSON

Success Response​

Returns an array of message objects.

[
{
"id": "msg-789e4567-e89b-12d3-a456-426614174000",
"type": "JSON",
"data": { "key": "value" },
"participantId": "1234abcd-56ef-78gh-90ij-klmnopqrstuv",
"createdAt": "2025-11-20T12:34:56.789Z"
}
// ...more messages
]

Get Message by ID​

GET /messages/:id

Retrieve a message by its unique ID.

Path Parameters​

ParameterTypeRequiredDescriptionExample
idstringYesMessage unique ID"msg-789e4567-e89b-12d3-a456-426614174000"

Success Response​

Returns the message object.

{
"id": "msg-789e4567-e89b-12d3-a456-426614174000",
"type": "JSON",
"data": { "key": "value" },
"participantId": "1234abcd-56ef-78gh-90ij-klmnopqrstuv",
"createdAt": "2025-11-20T12:34:56.789Z"
}

Error Responses​

  • 404 Not Found: Message not found

Error Format​

All error responses follow this format:

{
"statusCode": "ERROR_CODE",
"error": ["Description of the error"],
"requestId": "72e32108-6260-45e9-bb12-325fe3b61e42",
"path": "endpoint path",
"timestamp": "2025-11-19T16:32:57.915Z"
}

Field Descriptions​

FieldTypeDescription
idstringUnique identifier for the message
typeenumThe message type (JSON, etc.)
dataobjectThe message data
participantIdstringThe participant identifier
createdAtstringISO8601 timestamp of message creation

For more details, see CreateMessageDto and MessageController definitions.