Content List
Retrieves a list of content items from a project.
This endpoint
is useful for retrieving all content or filtering by a specific model.
For example, if you have a model named post
, you can use a query param
to retrieve all content of that model.
Endpoint
curl https://api.contentisland.net/api/1.0/contents --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Query Params
This endpoint accepts the following query parameters:
interface QueryParams { id?: Filter; contentType?: Filter; language?: Filter;}
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 |
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?contentType=post&language[in]=es,en --header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Response
The response is an array of JSON objects containing content information. Each object has the following structure:
export interface Content { id: string; contentType: { id: string; name: string }; lastUpdate: Date; fields: Field[];}
export interface Field { id: string; name: string; value: any; type: FieldType; isArray: boolean; language: string;}
id
: The content ID.contentType
: The model to which the content belongs. Contains anid
and aname
.lastUpdate
: The timestamp of the last update.fields
: An array of objects representing the content fields.
Example:
[ { "id": "1", "contentType": { "id": "100", "name": "post" }, "lastUpdate": "2023-10-01T12:00:00Z", "fields": [ { "id": "111", "name": "title", "value": "Hola Mundo", "type": "short-text", "isArray": false, "language": "es" }, { "id": "222", "name": "body", "value": "Este es el cuerpo del post en markdown.", "type": "long-text", "isArray": false, "language": "es" }, { "id": "333", "name": "order", "value": 1, "type": "number", "isArray": false, "language": "es" } ] }]
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. |