Skip to content

Content List Size

Retrieves the size of a content list from a project.

This endpoint is useful for retrieving the total number of content items, either overall or filtered by a specific model. For example, if you have a model called post, you can use this function to get the total number of content items of that model.

Endpoint

shell
curl https://api.contentisland.net/api/1.0/contents/size --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Query Params

This endpoint accepts the following query parameters:

interface ContentListSizeQueryParams {
id?: ClientFilter<string>;
contentType?: ClientFilter<string>;
language?: string;
`fields.${string}`?: ClientFilter; // Allows filtering by specific field values
// For example: 'fields.slug': 'my-post'
}
NameDescription
idThe id field of the content to retrieve. Useful for retrieving specific items by ID.
Example: /contents?id[in]=1,2,3
contentTypeThe model of the content you want to retrieve.
Example: /contents?contentType=post
languageThe language of the content to retrieve.
Only fields in the selected language will be returned.
Example: /contents?language=es
fields.${string}Allows filtering by specific field values.
Examples:
/contents?fields.slug=my-post
/contents?fields.title[in]=hello%20world,hola%20mundo
Retrieves content with fields matching the specified values.
type ClientFilter<Type = string | boolean | number> =
| Type
| {
in?: Type[];
ne?: Type;
nin?: Type[];
};
NameDescription
stringFilters content where the parameter equals the specified value.
Example: /contents?contentType=post
Retrieves content where the model is equal to post.
inFilters content where the parameter matches any of the provided values.
Example: /contents?language[in]=es,en
Retrieves content fields matching es and/or en.
neFilters content where the parameter does not equal the specified value.
Example: /contents?contentType[ne]=page
Retrieves content where the model is not page.
ninFilters content where the parameter does not match any of the provided values.
Example: /contents?contentType[nin]=page,post
Retrieves content where the model is neither page nor post.

Example:

shell
// Retrieve a list of content items filtered by model and language
curl https://api.contentisland.net/api/1.0/contents/size?contentType=post&language[in]=es,en --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Response

The response from this endpoint is a number representing the size of the content list that matches the provided query parameters.

Example:

Terminal window
42 // Example response indicating the size of the content list

Status Codes

CodeDescription
200The request was successfully processed and the content list was returned.
400Bad request. A query parameter failed validation — e.g. a malformed id.
401Unauthorized. The access token is invalid or has expired.
500Internal server error. An error occurred while processing the request.

Error responses follow the uniform contract documented in Errors{ "error": { "code", "message", "requestId", "details?" } }.