Rest API's

Flextype provides APIs organized around Representational State Transfer (REST) to manage the data. The API has predictable resource-oriented URLs, relies on standard HTTP status codes, and uses JSON for input and output.

Entries

For more details read the reference guide for the Entries API.

Tokens

For more details read the reference guide for the Tokens API.

Cache

For more details read the reference guide for the Cache API.

Registry

For more details read the reference guide for the Registry API.

Authentication

To retrieve or store content with Flextype, you first need to authenticate your app with an token. Flextype offers three APIs, and each requires separate authentication.

We recommend using different access tokens for different environments in your development process. For example, use one for your production environment and another for staging or continuous integration. This allows you to revoke them individually in the future and manage your delivery channels independently.

You should send the authentication token token to an API as a query parameter for GET requests and for all POST, PUT, PATCH, DELETE requests you should send the access authentication token access_token to an API inside request body.

Create a new token

Go to your console and run the following command:

bin/flextype tokens:create

This will create a new token and a hashed access token.

HTTP details

Cross-origin resource sharing

CORS (Cross-origin resource sharing) allows JavaScript web apps to make HTTP requests to other domains. This is important for third party web apps using Flextype, as without CORS, a JavaScript app hosted on example.com couldn't access our APIs because they're hosted on another.com which is a different domain.

CORS is supported by all modern browsers. Read more about using CORS in this tutorial.

JSON format details

Flextype represents resources as JSON, encoded in UTF-8. Flextype represents dates and times as Unix Timestamp.

Errors

When something goes wrong with an API request, our server generates an error. The error message contains an appropriate HTTP status code in the header and a JSON response in the body.

Error types

HTTP status code Title Message
400 Bad Request Validation for this particular item failed
401 Unauthorized Token is wrong
404 Not Found The requested resource or endpoint could not be found