Cosmic JS Blog Stay tuned for community news, company announcements and updates from the Cosmic JS team.

API Updates: Authentication, Add Buckets and More

Cosmic JS is on a mission to help you build apps faster.  With this goal in mind, we're happy to announce some additions to our API that will help you manage your application content faster and easier, right from the Cosmic JS API.

We’ve added new endpoints to the API which include:
1. User Authentication
2. Add Buckets to your account
3. Add / Edit / Delete Object Types in your Bucket
4. Add Media to a folder in your Bucket
Check out the Docs page for all of the new additions to the API.

Have you ever wanted to access your account from the API and create new Buckets from the comfort of your own application?  Well now you can thanks to the new POST /authenticate endpoint.  Simply add your Cosmic JS email and password, get your token, then begin performing account-specific tasks from the API.  Currently this only includes Bucket creation, but we plan to open up more features for account management soon.

POST /authenticate

  "email": "",
  "password": "CatsAreAwesome"

Read more about Authentication

Add Buckets
Use the new POST /buckets endpoint to add your new Bucket to your account.  The only required fields are title and a Header with Authorization: Bearer <token>.
Read more about adding Buckets

Add / Edit / Delete Object Types
Add Object Types with POST /:your-bucket-slug/add-object-type
Edit Object Types with PUT /:your-bucket-slug/edit-object-type
Delete Object Types with DELETE /:your-bucket-slug/:object-type-slug
Read more about Object Types

Add Media to Folders
You can now add Media to your Bucket and specify which folder to place it in.

POST /:your-bucket-slug/media

  "media": FILE_DATA,
  "folder": "your-folder-slug"

Read more about adding Media

I hope you find these new additions to the API useful for building your applications.  Browse the API docs to see more detail on how to use the new additions to the API.  If you have any questions reach out to us on Twitter and join our Slack community.

Icon provided by Iconfinder.

You may also like

The same API that delivers your content to all web-connected devices can also store the media you need to publish.

In this Cosmic JS Developer Spotlight, we sat down with Kevin Grossnicklaus, Principal of ArchitectNow, a St. Louis-based software development firm that specializes in helping customers design, build, and launch rich web and mobile applications across a variety of industries.

In this tutorial I'm going to show you how to create an "Events" app using a little bit of Node, Angular JS and Cosmic JS. For the sake of understanding how to consume Restful API’s, this tutorial will show how to make simple AJAX requests to the Cosmic JS API in order to retrieve, update, and delete data in our Cosmic JS Buckets.

Cosmic JS is an API-first cloud-based content management platform that makes it easy for teams of developers and content editors to collaborate for projects and clients.

Variety is the spice of life and it is essential to flexible content management.  Currently I'm seeing the trend of data storage move from relational to on-the-fly structures.  Relational databases like MSSQL and MySQL are being less favored and more developers are choosing to move to NoSQL databases like MongoDB.  By more developers I include myself because this is a very flexible and intuitive way to store data.  Key / Value, or as I like to call on-the-fly, content storage is the next stage of content management.  Relational structures bind where on-the-fly sets free.  This is the theory behind Cosmic JS metafields.

Content items are like people in that they come in all shapes, sizes and colors.  Cosmic JS objects allow you to create metafields which give you the power to add on-the-fly key / value pairs.  Create infinite metafields and drag and drop them into parent / child relationships. 

I find it so much easier to keep track of my key / value pairs per object rather than managing a relational schema.  I believe this is the new way of on-the-fly content management that will allow for flexibility and scalability of future content.

In this installment of the Cosmic JS Developer Spotlight Series, we sat down with Brandon Reid, a JavaScript developer residing in Dallas, Texas who's currently Lead Developer at Simple Media. Brandon recently launched a new React / Node website on Cosmic for The Arnold Companies, an energy and aviation client. Follow Brandon on LinkedIn and GitHub, and enjoy the Q/A.