Javascript
Last updated
Last updated
In this section, we will take you on a jouhrney through the powerful features and functionalities of our Javascript SDK, designed to empower you in creating seamless and innovative digital project that connect to Atlas CMS.
In order to get started with the Atlas CMS JS SDJ you'll need only to install the package from the npm registry
To initialize the client you need and Api Token and a Project Id you want to connect.
To get these information please check the documentation here and here.
The client expose all methods we covered in the API Reference section and they are available in each service inside the client:
client.contents = for contents
client.models = for models and components
client.mediaLibrary = for assets and folders
client.users = for project's users and roles
For example we we want to fetch the Contents of the posts
collection we can use the client like this:
or if for example we want to fetch a media object we can use the client as the following:
To simplify the creation of the query parameters you can use to filter Contents, the SDK implemente a fluent query builder that you can use to avoid string concatenation or many other logics in your code.
For example if you want to fetch the last 10 posts
where the category
field is equals
to 'sport' and the post date
is greater or equals
to 'January 1st 2023' ordered
descending by the date field