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?: Filter;
contentType?: Filter;
language?: Filter;
`fields.${string}`?: Filter; // 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 Filter =
| string
| {
in?: string[];
// More filters to be added in the future
};
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.

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.
401Unauthorized. The access token is invalid or has expired.
500Internal server error. An error occurred while processing the request.