Add Entity to List
Endpoint
URL: /:projectId/lists/:listId/add-entity
Method: PATCH
Authentication Required: Yes
Description
Adds an entity to the specified list for the authenticated user. Prevents duplicate additions.
Request
Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Bearer token for authentication. |
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
listId | string | Yes | ID of the target list. |
Body Parameters
Field | Type | Required | Description |
---|---|---|---|
entityId | string | Yes | ID of the entity to add to the list. |
Example Request
{
"entityId": "abc123"
}
Response
Success Response (200 OK)
{
"id": "list_abc",
"projectId": "proj1234",
"userId": "user_xyz",
"name": "Favorites",
"entityIds": ["abc123", "xyz789"],
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
Error Responses
Missing listId or entityId (400 Bad Request)
{
"error": "Missing listId",
"code": "list/missing-data"
}
List Not Found (404 Not Found)
{
"error": "List not found",
"code": "list/not-found"
}
Entity Already Exists (409 Conflict)
{
"error": "Entity already exists in the list",
"code": "list/entity-exists"
}
Server Error (500 Internal Server Error)
{
"error": "Internal server error.",
"code": "list/server-error",
"details": "<Error message>"
}
Notes
- Entity will not be added again if it already exists in the list.
- The response includes the updated and populated list object.