Contents

In Atlas CMS, Contents are the entities you add through the Admin UI or the API.

They are composed by a common set of properties and the set of attributes specified in the underneath Contents.

Content Object

The Content data model is like the following:

{
    "id": "string",
    "locale": "string",
    "createdAt": "datetime",
    "createdBy": "string",
    "modifiedAt": "datetime",
    "modifiedBy": "string",
    "hash": "string",
    "stage": "string",
    "modelId": "string",
    "modelKey": "string",
    "attributes": {
        "prop1": ...,
        "prop2": ...,
        
    },
    "locales": [
        {
            "id": "string",
            "culture": "string"
        }
    ]
}    
Property
Description

id

The Entity ID.

locale

The Entity Locale. If Model is not localizable this property is not available.

createdAt

Creation date (UCT).

createdBy

The username of the user who created the Entity.

modifiedAt

Modify date (UTC).

modifiedBy

The username of the user who modified the Entity.

stage

published or unpublished. If Model doesn't have the Stage mode active this property is not available.

modelId

The Id of the underneath model.

modelKey

The Api Key name of the underneath model.

attributes

The object with the properties defined in the model.

locales

The list of the translations id/culture. If Model is not localizable this property is not available.

hash

The hash representation of the attributes.

Attributes and Fields

The Content object contains an attribute property. Inside it there are all the fields, in the form of Json properties, defined for the model with the relative value inserted for the Content.

In addition, each field has the option of being filtered using specific field operators.

You can check here all the available filtering options for fields.

Field Representations

Each field has its own Json representation which corresponds to the underlying data type. Sometimes, these representations can be different between when you send data and when you receive for the purpose of simplification and freedom of use.

Text

Data type: string

Rich Text

Data type: string

Number

Data type: integer or decimal based on selected editor

Yes/No

Data type: boolean

Date

Data type: string (yyyy-MM-dd)

When send data can be either string (yyyy-MM-dd) or number (yyyyMMdd)

Date & Time (CHECK)

Data type:

Time (CHECK)

Data type:

Single Choise

Data type: string

Enumeration

Data type: Array of strings

Tags

Data type: Array of strings

Media

Data type: string or object

When sending data can be string (id of the Media object) or object (media object).

When receiving data is string (id of the media object) or object (if resolve=media parameter is passed).

Single Choise

Data type: string

Map (CHECK)

Data type:

Key/Value

Data type: Array of objects

[ { "key": "key1", "value": "value1" }, { "key": "key1", "value": "value1" }, { "key": "key1", "value": "value1" }, ... ]

Value Array

Data type: Array of strings

Json

Data type: object or array

Relations

Data type: Array of strings or Array of objects

When sending data can be Array of strings (id of the Content).

When receiving data is Array of strings(id of the media object) or Array of objects(if resolve=relations parameter is passed)

Component (CHECK)

Data type: object

Multi Component (CHECK)

Data type: Array of objects

Reference

List Contents

Return a paged list of contents entries

GET /contents/{model-key}

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Query Parameters

Name
Type
Description

page

Integer

The number of page to return default = 1

size

Integer

The number of entries to return for the page

default = 25

locale

String

The locale to filter contents

default = locale set as default in settings

filter

String

Read here on how filtering contents

resolve

String

Accept media, mediagallery, relations. (optional) Tells the API to eagerly load and returns the full object for Media, Galeries and Relations instead the ID reference

stage

String

Accept publish or unpublilshed default = published

sort

String

{
    "data": [{
            "id": "string",
            "locale": "string",
            "createdAt": "datetime",
            "createdBy": "string",
            "modifiedAt": "datetime",
            "modifiedBy": "string",
            "hash": "string",
            "stage": "string",
            "modelId": "string",
            "modelKey": "string",
            "attributes": {
                "prop1": ...,
                "prop2": ...,

            },
            "locales": [{
                    "id": "string",
                    "culture": "string"
                }
            ]
        }, {
            "id": "string",
            "locale": "string",
            "createdAt": "datetime",
            "createdBy": "string",
            "modifiedAt": "datetime",
            "modifiedBy": "string",
            "hash": "string",
            "stage": "string",
            "modelId": "string",
            "modelKey": "string",
            "attributes": {
                "prop1": ...,
                "prop2": ...,

            },
            "locales": [{
                    "id": "string",
                    "culture": "string"
                }
            ]
        },
        ....
    ],
    "metadata": {
        "currentPage": 1,
        "pageSize": 25,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "totalPages": 1,
        "count": 1
    }
}

Count Contents

Return the total number of contents entries

GET /contents/{model-key}/count

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Query Parameters

Name
Type
Description

locale

String

The locale to filter contents

default = locale set as default in settings

filter

String

Read here on how filtering contents

stage

String

Accept publish or unpublilshed default = published

{
    "result": 140
}

Get Content

Return a content entry by Id

GET /contents/{model-key}/{id}

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

id

String

The Id of the content

Query Parameters

Name
Type
Description

resolve

String

Accept media, mediagallery, relations. (optional) Tells the API to eagerly load and returns the full object for Media, Galeries and Relations instead the ID reference

{
    "id": "string",
    "locale": "string",
    "createdAt": "datetime",
    "createdBy": "string",
    "modifiedAt": "datetime",
    "modifiedBy": "string",
    "hash": "string",
    "stage": "string",
    "modelId": "string",
    "modelKey": "string",
    "attributes": {
        "prop1": ...,
        "prop2": ...,
        
    },
    "locales": [
        {
            "id": "string",
            "culture": "string"
        }
    ]
} 

Create Content

Create a new content entry

POST /contents/{model-key}

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Request Body

Name
Type
Description

{ }*

Json Object

{
    "id": "string",
    "locale": "string",
    "createdAt": "datetime",
    "createdBy": "string",
    "modifiedAt": "datetime",
    "modifiedBy": "string",
    "hash": "string",
    "stage": "string",
    "modelId": "string",
    "modelKey": "string",
    "attributes": {
        "prop1": ...,
        "prop2": ...,
        
    },
    "locales": [
        {
            "id": "string",
            "culture": "string"
        }
    ]
} 
//Sample payload
{
    "locale": "en-US",
    "attributes": {
        "prop1": "value",
        "prop2": {
            "prop1": "value",
            "@component": {
                "id": "64f87b9aa81609051d832bec",
                "key": "component-key"
            }
        },
        "prop2": ["1", "2", "3", ""],
        "prop3": [{
                "key": "Key1",
                "value": "Value1"
            }, {
                "key": "Key2",
                "value": "Value2"
            }
        ]
        ....
    }
}
  • locale: the locale of the content

  • attributes: the object representing the field/value defined in the model. The check the data type of each field read here

Update Content

Update a content entry

PUT /contents/{model-key}/{id}

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

id*

String

The content id to update

Request Body

Name
Type
Description

{ }*

Json Object

{
    "data": [{
            "id": "string",
            "locale": "string",
            "createdAt": "datetime",
            "createdBy": "string",
            "modifiedAt": "datetime",
            "modifiedBy": "string",
            "hash": "string",
            "stage": "string",
            "modelId": "string",
            "modelKey": "string",
            "attributes": {
                "prop1": ...,
                "prop2": ...,

            },
            "locales": [{
                    "id": "string",
                    "culture": "string"
                }
            ]
        }, {
            "id": "string",
            "locale": "string",
            "createdAt": "datetime",
            "createdBy": "string",
            "modifiedAt": "datetime",
            "modifiedBy": "string",
            "hash": "string",
            "stage": "string",
            "modelId": "string",
            "modelKey": "string",
            "attributes": {
                "prop1": ...,
                "prop2": ...,

            },
            "locales": [{
                    "id": "string",
                    "culture": "string"
                }
            ]
        },
        ....
    ],
    "metadata": {
        "currentPage": 1,
        "pageSize": 25,
        "hasPreviousPage": false,
        "hasNextPage": false,
        "totalPages": 1,
        "count": 1
    }
}
//Sample payload
{
    "attributes": {
        "prop1": "value",
        "prop2": {
            "prop1": "value",
            "@component": {
                "id": "64f87b9aa81609051d832bec",
                "key": "component-key"
            }
        },
        "prop2": ["1", "2", "3", ""],
        "prop3": [{
                "key": "Key1",
                "value": "Value1"
            }, {
                "key": "Key2",
                "value": "Value2"
            }
        ]
        ....
    }
}
  • attributes: the object representing the field/value defined in the model. The check the data type of each field read here

Good to know: To preserve consistency when a model change or to optimize the size of a payload, Atlas CMS content update API act like a patch for the attributes objects. This because the model can change, adding, removing o changing the fields, while your code may not be synchronized with the model at the time of change. If you want clean-up a field in the attribute object you have always to specify it and passing null as long as the fieldexists in the model. On the other side, if you pass fields that are not available in the model they are skipped. The only exceptions on this is when you have new required field in the model and the payload doesn't contains it. In this case you will receive a 429 Http Error.

Delete Content

Delete a content entry

DELETE /contents/{model-key}/{id}

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Request Body

Name
Type
Description

{ }*

Json Object

Duplicate Content

Create a copy of a content entry

POST /contents/{model-key}/{id}/duplicate

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Request Body

Name
Type
Description

{ }

Json Object

//Reponse in case of locales parameter false
{
    "result": "new id"
}

//Reponse in case of locales parameter true
[
    { "result": "new id" }, 
    { "result": "new id" }, 
    { "result": "new id" }
    ...
]
//Sample payload
{
    "locales": true/false
}
  • locales: tells the system to create a copy of the object and all its localized versions

Create Translation

Create a content in a new language

POST /contents/{model-key}/{id}/create-translations

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

id*

String

The content Id

Request Body

Name
Type
Description

{ }*

Json Object

{
    "result": "new id"
}
//Sample payload
{
    "locale": "it-IT"
}
  • locale: the locale for which to create the content from the content id provided

Publish Content

Publish a content entry

POST /contents/{model-key}/{id}/publish

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

id*

String

The content Id

Unpublish Content

Unpublish a content entry

POST /contents/{model-key}/{id}/unpublish

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

id*

String

The content Id

Delete all contents

Delete all content entries

DELETE /contents/{model-key}/clear

Path Parameters

Name
Type
Description

model-key*

String

The Model's key name. Read here

Request Body

Name
Type
Description

{ }*

Json Object

Last updated