Announcing the Cosmic REST API v2, New Docs
We are excited to introduce Cosmic REST API v2 (alpha). The API has been rebuilt from the ground up to be lighter, faster, with lots of new features to make building Cosmic-powered apps even better.
Along with this release, we've built a brand new documentation site to help you learn more about all the new features. We recommend you start there to get all the latest and greatest in this release. Read below to get a breakdown of the new features, improvements, and changes.
metadataprops are now possible without limit. See examples of nested props.
- No depth limit for Object relationships. The only limit is the prevention of infinite recursion.
- We now offer a Postman collection to review and demo all REST API methods.
- You can now use the
afterparam for Object pagination.
- We now have endpoints for
Media Foldersto do CRUD operations directly.
- Lighter codebase, faster endpoints. In some cases, endpoint response times are up to 50% faster (non-cached).
- Better endpoint structures that follow standard REST conventions such as
GET /resources/:resource_id, etc.
- Consistent error responses with verbose messages.
- The Select Dropdown Metafield now includes both
valuein the API response.
_idhas been changed to
type_slughas been changed to
statuscan now either be
any(which returns latest Object version draft or published).
queryis now the primary method for fetching and filtering Objects (Advanced Queries from v1). See Queries and Logic for examples.
- Single Objects must now be fetched using
id. To fetch by
slug, you will need to use
write_keywill now be required in the request header as
metafieldsare hidden by default.
- Stricter user input requirements. No additional fields are possible in the body for
- There is a new, more secure token authentication strategy.
Read the docs to learn more about all the updates and improvements. We would appreciate your input as we get the REST API v2 ready for production. If you have any comments or questions, please drop them in the comments below or in our Slack channel.
- Cosmic Team