Using a Content Modeling API


A Content Modeling API can not only help with content publishing speed and ease, but also preserve the integrity of your application overall. Early decoupled systems still assumed the developer was working within PHP, which only solved half the problem as new modern frameworks and languages further promoted light-weight interactive touch points within applications. 

Cosmic JS is a headless content management system that decouples content from code. The CMS API can plug into any internet-connected application, regardless of programming language, so you can use the tools you love to build apps faster. 



Cosmic JS Content Modeling API:

Cosmic JS is a hosted service that includes a web Dashboard and API. It is unopinionated about your application layer and is not tied to any programming language like a CMS that you install and maintain. Simply connect to the API for content and build your app in the language you choose. Get started by reading the documentation.



A basic way to think of Cosmic JS' structure is:

github-graphic.png

Bucket: Your website
Object Type: The blog posts on your website
Object: A blog post
Metafield: A picture on your blog post
Metafield: The author of your blog post


Buckets:


A Bucket is the main piece in the Cosmic JS content structure. It's very flexible and can power the content for an entire website or a portion of a website. Since your Bucket content is delivered via an API endpoint, your Bucket can also power content for any application including iOS, Android, tvOS, Apple Watch, IOT, AR/VR or any other way that you would like to distribute your content.


Objects:


An Object can be a page, a blog post, or anything you want it to be. Cosmic JS gives you the freedom to create and manage content openly and create your own data structure. Each Object allows for the creation of a title, slug, content and Metafields.


Object Title:

{ 
  "title": "My Page Title"
}

  

Object Slug:

{ 
  "title": "My Page Title",
  "slug": "my-page-title"
}

 

Object Content:


Add content to your Object. You can upload media, add formatted text and other rich text options available in the editor. This will be available as HTML from your API endpoint in the content property.

{ 
  "title": "My Page Title",
  "slug": "my-page-title",
  "content": "

My object content with HTML sprinkled in.

" }


Metafields:

Metafields are very powerful pieces of custom data that can be added to objects that can be recursively nested. Your created Metafields are transformed into key/valued Metadata in the API endpoints.

Metafield options include Text, Textarea, HTML Textarea, File / Image, Repeater and more. Your Object's Metafields will be available as key / values in your API endpoint from the metadata property.

{ 
  "title": "My Page Title",
  "slug": "my-page-title",
  "content": "

My object content with HTML sprinkled in.

",   "metadata": {     "headline": "Welcome to My Website!"   } }

All of this, of course, is easily navigable through the Cosmic JS Dashboard. 


Cosmic JS Dashboard:



Conclusion:


Cosmic JS offers an intuitive API that can deliver content to any website or application. This gives you the freedom to build your application using any programming language and allows for easier scaling within your development team. The Cosmic JS Dashboard makes it easy to manage content, drag and drop media and build content relationships. Flexible user roles and permissions are available so team members see only what they need to get their job done. 

Please feel free to reach out to me personally if you have any questions or comments.

carson@cosmicjs.com 

Was this article helpful?

Thank you! Your input helps us improve our articles and resources. If you have any other questions or comments, please contact support.

You may also like


Here we build a progressive web app in React.js with the power of Cosmic JS. It respond with status 200 and carries data when you disconnected to internet and in Chrome browser (both mobile and desktop) it gives an option to install the app on home screen.
This app is built using Vue and connects to the Cosmic JS API. You can manage your content from your Cosmic JS Dashboard.
Cosmic JS lets you build one-to-one as well as one-to-many Object Relationships within your Bucket Dashboard. To help you and your team manage content more seamlessly, you can now see your Connected Objects located on the Object’s Edit page in the Dashboard.
An Object in Cosmic JS can be a page, a blog post, an author or anything you want it to be. Cosmic JS gives you the freedom to create and manage content openly and create your own data structure. Each Object allows for the creation of a title, slug, content and Metafields.
This article will demonstrate how to build a simple ecommerce website with the purpose of showing how we can offer a customized experience for everyone. Our data will be stored and served by Cosmic JS and we will use Angular for our Front-End.
Hi, In this tutorial, we are going to create an application that filters twitter tweets by selecting a specific location on the map. We are going to use React and Cosmic JS. We will be using Cosmic JS npm package for saving and sorting the most popular searches in our application. Let's get started.