Get Started

Authorization

To work with the public Api first go to the Project Settings page in the Livingdocs Editor and create an AccessToken.

Embed the AccessToken in the header of every HTTP request as shown below.

Request HTTP headers

Accept: application/json
Authorization: Bearer ey1234

Auth Example with Curl

ACCESS_TOKEN=ey1234
curl -k -X GET "http://localhost:9090/api/v1/project"
  -H "Accept: application/json"
  -H "Authorization: Bearer $ACCESS_TOKEN"

Auth Example with Axios

const axios = require('axios')
const token = 'ey1234'
const result = await axios.get('api/v1/project', {
  baseURL: 'http://localhost:9090',
  headers: {Authorization: `Bearer ${token}`},
  timeout: 20000
})

Errors

Common error responses you can expect when working with the public Api.

Response

401
Unauthorized
{
  "status": 401,
  "error": "Unauthorized",
  "error_details": {
    "access_token": "The access token expired."
  }
}

Response

403
Forbidden
{
  "status": 403,
  "error": "Forbidden",
  "error_details": {
    "access_token": "The request requires higher privileges"
  }
}

Response

404
Not Found
{
  "status": 404,
  "error": "Not Found",
  "error_details": {
    "url": "/api/v1/foo"
  }
}

Base URL

This is the base Url you will need to interact with our API.

https://server.livingdocs.io/

Alternatively speed up your development process using our Software Development Kit.

My First Response

For testing purposes, you can go and run the following code snippet in your Terminal.

Don’t forget to replace your token.

Get your First Response

Curl Example
curl -H 'Authorization: Bearer your_token' \ 
https://server.livingdocs.io/api/v1/documents/latestPublications

Response (may differ in details)

200
OK
[
  {
    "systemdata": {
      "projectId": 1,
      "channelId": 1,
      "documentId": 1,
      "contentType": "article",
      "documentType": "article",
      "publicationId": 1,
      "firstPublicationDate": "2021-03-16T14:08:11:686Z",
      "updatedAt": "2021-03-18T16:32:04.170Z",
      "layout": "regular",
      "design": {
        "name": "timeline",
        "version": "1.1.0"
      }
    },
    "metadata": {
      "title": "a title",
      "description": "some lead",
      "dependencies": {}
    },
    "content": [
      {
        "id": "doc-1b8i1ksh10",
        "identifier": "timeline.head",
        "component": "head",
        "content": {
          "title": "a title",
          "text": "some lead"
        }
      },
      {
        "id": "doc-1b8i1ksh20",
        "identifier": "timeline.normal",
        "component": "normal",
        "content": {
          "caption": "my caption"
        },
        "styles": {
          "position": "left"
        }
      },
      {
        "id": "doc-1b8i1ksh30",
        "identifier": "timeline.p",
        "component": "p",
        "content": {
          "text": "first paragraph"
        }
      },
      {
        "id": "doc-1b8i1me1d0",
        "identifier": "timeline.p",
        "component": "p",
        "content": {
          "text": "second paragraph"
        }
      }
    ]
  },
  {
    "systemdata": {
      "projectId": 1,
      "channelId": 1,
      "documentId": 2,
      "contentType": "article",
      "documentType": "article",
      "publicationId": 5,
      "firstPublicationDate": "2021-03-17T15:09:12:687Z",
      "updatedAt": "2021-03-19T17:33:05.171Z",
      "layout": "regular",
      "design": {
        "name": "timeline",
        "version": "1.1.0"
      }
    },
    "metadata": {
      "title": "another title",
      "description": "some other lead",
      "dependencies": {}
    },
    "content": [
      {
        "id": "doc-1b8i1ksh10",
        "identifier": "timeline.head",
        "component": "head",
        "content": {
          "title": "a title",
          "text": "some lead"
        }
      },
      {
        "id": "doc-1b8i1ksh20",
        "identifier": "timeline.normal",
        "component": "normal",
        "content": {
          "caption": "my caption"
        },
        "styles": {
          "position": "left"
        }
      },
      {
        "id": "doc-1b8i1ksh30",
        "identifier": "timeline.p",
        "component": "p",
        "content": {
          "text": "first paragraph"
        }
      },
      {
        "id": "doc-1b8i1me1d0",
        "identifier": "timeline.p",
        "component": "p",
        "content": {
          "text": "second paragraph"
        }
      }
    ]
  }
]