Skip to main content
Add Entity to Collection
Saves an entity into the specified collection. Saving an entity that is already in the collection is not an error: it answers 200 with the same body and creates no duplicate (unless the user can no longer read it, which answers 404 as below, and leaves it saved). A new save answers 201. Two saves of the same entity sent at the same time get one 201 and one 200, with the same summary, never a server error. An entity the user can’t read can’t be saved: one in a space the user can’t read (see who can read content), or one whose author has blocked the user. It answers 404 entity/not-found, the same as a missing entity.

Path Parameters

string
required
The ID of the collection to save the entity into.

Body Parameters

string
required
The ID of the entity to save.
string
Service key only, and required with one: the user this request acts as. Must own the collection. A user token always acts as its own user and must not send it (400 collection/acting-user-not-allowed).

Response

The collection’s summary after the save, the same body either way: 201 when the entity was newly added, 200 when it was already in the collection.
string
Collection ID.
string
The collection’s name.
number
The collection’s entityCount after the save (also when the entity was already saved).

Error Responses

The entity doesn’t exist, it’s in a space the user can’t read, or its author has blocked the user.
A service key sent no actingUserId.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token, or with no credentials: