Tony Spiro
June 01, 2017
Cosmic 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 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.
Authentication
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 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": "john@johndoe.com",
"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"
}
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.