Getting notes for an entity
Contents
Overview
- Call name: get-note
- Endpoint URL: https://api0.spaaza.com/internal/get-note
- Request methods: GET
- Response Content-Type: application/json
- Auth required: yes
X-Spaaza-MyPrice-App-Hostname
header requirement: mandatory when using privileged authentication
This API call retrieves notes for an entity. You can retrieve a specific note by its ID or all notes for a specific entity. Currently, notes are only supported for User and Campaign entities.
Permissions and Authentication
This API call requires a valid Spaaza session. The session can be as follows:
- Admin authentication: the performing user needs to be logged in and have
read access
for the entity from which notes are being retrieved. - Privileged authentication: the use of privileged authentication is permitted for this endpoint.
Request Parameters
The following parameters can be passed to the API:
Parameter | Description |
---|---|
note_id | (integer, conditional) The ID of the specific note to retrieve. Either note_id or both model_class and model_id must be provided. |
model_class | (string, conditional) The class of the entity. Must be either “User” or “Campaign”. Required if note_id is not provided. |
model_id | (integer, conditional) The ID of the entity for which to retrieve notes. Required if note_id is not provided. |
Response Format
When retrieving a single note by note_id, the response will be a JSON object containing the note details:
{
"id": 12345,
"text": "Customer very happy with her latest purchase.",
"created_date": "2025-04-18T10:15:30Z",
"model_class": "User",
"model_id": 67890,
"creating_user": {
"user_id": 54321,
"name": "John Doe"
}
}
When retrieving all notes for an entity using model_class and model_id, the response will be an array of note objects:
[
{
"id": 12345,
"text": "Customer very happy with her latest purchase.",
"created_date": "2025-04-18T10:15:30Z",
"model_class": "User",
"model_id": 67890,
"creating_user": {
"user_id": 54321,
"name": "John Doe"
}
},
{
"id": 12346,
"text": "Customer requested information about loyalty program.",
"created_date": "2025-04-17T14:22:10Z",
"model_class": "User",
"model_id": 67890,
"creating_user": {
"user_id": 54322,
"name": "Jane Smith"
}
}
]
If no notes are found for the specified entity, an empty array is returned.
Possible error responses
Code | HTTP Status | Description |
---|---|---|
invalid_parameters | 400 | Either note_id or both model_class and model_id are required. |
invalid_parameter | 400 | The model_class parameter must be User or Campaign. |
object_not_found | 404 | The specified note or entity could not be found. |
saving_object_error | 500 | There was an error during database operation. |