Comfortable | Docs
  • Comfortable Documentation
  • Concepts
    • Content Repositories
    • Content Types
    • Documents
    • Assets
    • Content Tree
    • Collections
    • Webhooks
    • Team
    • Locales
  • APIs
    • RESTful API
      • Endpoints
      • API Reference
        • Sorting
        • Filters
        • Localisation
        • Fields
        • Includes
        • Search
      • Query Examples
        • Collections
        • Single Documents
        • Single Assets
        • Sorting
        • Filters
        • Includes
    • Image Manipulation
  • SDKs
    • JavaScript
      • Query Options
      • Query All Documents
      • Query a Collection
      • Query a Single Document
      • Query an Alias
      • Query an Asset
      • Example: Filters
      • Example: Sorting
    • Nuxt.js
    • PHP
      • Query All Documents
      • Query Single Document
      • Query Collection
      • Query an Alias
      • Query an Asset
      • Fulltext Search
      • Query by Fields
      • Query by Type
      • Query by Id
      • Query by Tags
  • Guides
    • Vue Blog Example
  • Legal
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • Introduction
  • API Keys
  • Creating API Keys
  • Editing
  • Revoking or Deleting
  • Types of Keys
  • Usage
  1. APIs

RESTful API

Introduction

API Base URL

https://api.cmft.io/v1/

Basic Query Structure

https://api.cmft.io/v1/<repoName>/<endpoint>?key=<apiKey>
curl 'https://api.cmft.io/v1/<repoName>/<endpoint>' \
  -H 'Authorization: <apiKey>'
window.fetch('https://api.cmft.io/v1/<repoName>/<endpoint>', {
  method: 'get',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': '<apiKey>'
  }
})
  .then(function (response) { return response.json() })
  .then(function (data) {
    console.log(data)
  })

Example Document Structure

{
  "fields": {
    "title": "Roses are red"
  },
  "meta": {
    "id": "314159265358979323",
    "contentType": "poem",
    "repository": "314159265358979323",
    "revision": 1,
    "tags": [],
    "createdAt": "2018-01-01T00:00:00.000Z",
    "updatedAt": "2018-01-01T00:00:00.000Z"
  }
}

API Keys

The API Key is mandatory and can be included in the Authorization Header or the URL for GET requests. One key is always valid for the associated repository.

Creating API Keys

By default there will be an auto-generated API Key for your repository. However, you can always create additional keys.

  1. Navigate to the 'Settings' page and select the tab 'API Keys'.

  2. On the field below,

  3. Click the 'Create New Key'-Button.

Editing

The keys are generated by our API, therefore you can only change the name you use to describe a keys purpose.

  1. Navigate to the 'Settings' page and select the tab 'API Keys'.

  2. Click the 'Pencil'-Button when hovering a key in the list.

  3. Make your changes.

  4. Confirm by clicking the 'Checkmark'-Button

Revoking or Deleting

You can delete any additional API Keys.

  1. Navigate to the 'Settings' Page and select the tab 'API Keys'.

  2. Click the 'Pencil'-Button when hovering a key in the list.

  3. Click the 'Trashcan'-Button.

  4. Confirm.

Types of Keys

Currently there are just read-only keys. Once we've published the write API, we're going to offer different types of keys.

Usage

The API Key can be either included as Query Parameter in the URL or in the Authorization Header. However when making POST requests, the key must be provided in the Authorization Header.

PreviousLocalesNextEndpoints

Last updated 6 years ago