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
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'}
Name | Description |
---|---|
id | The id field of the content to retrieve. Useful for retrieving specific items by ID.Example: /contents?id[in]=1,2,3 |
contentType | The model of the content you want to retrieve. Example: /contents?contentType=post |
language | The 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 };
Name | Description |
---|---|
string | Filters content where the parameter equals the specified value.Example: /contents?contentType=post Retrieves content where the model is equal to post . |
in | Filters 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:
// Retrieve a list of content items filtered by model and languagecurl 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:
42 // Example response indicating the size of the content list
Status Codes
Code | Description |
---|---|
200 | The request was successfully processed and the content list was returned. |
401 | Unauthorized. The access token is invalid or has expired. |
500 | Internal server error. An error occurred while processing the request. |