A subset of API for use with Mobile.
You will need an Auth0 id_token. You can generate one by:
- Go to https://dashboard.dev.clarityhub.io
- Login
- Open the Dev Tools
- Open Network Tab
- Look for the following request: https://clarityhub.auth0.com/oauth/token
- You will get the id_token from the response.
Run the server:
npm i
npm i -g serverless
serverless dynamodb install
SLS_DEBUG=* serverless offline start --host=0.0.0.0 --stage local
To test the API, you can do the following in Postman:
- URL: http://0.0.0.0:4000/interviews
- Method: Get
- Headers, add Authorization Bearer Token. Set the token to the ID Token from above.
Use the Authorization
header with a Bearer token
.
The Bearer token
value should be the id_token
you received when
logging in via Auth0.
When hitting production, you will need an API Key. Add this to your header as x-api-key
and the API Key set as the value. Ask your admin for a key.
Get a list of interviews.
Authorization: See authorization
Empty Response:
{
"tagItems": [],
"items": []
}
Single response:
{
"tagItems": [
[]
],
"items": [
{
"workspaceId": "idmontie@gmail.com",
"id": "694f9a2b-fbe0-4452-a3b7-558e7b1d0939",
"updatedAt": "2019-10-29T02:43:16.965Z",
"content": "[]",
"title": "My title",
"createdAt": "2019-10-29T02:43:16.964Z"
}
]
}
Create an interview.
Authorization: See authorization
title: The title of the interview. Simple text field.
content: Stringified JSON column. Represents rich-text. The value []
represents an empty rich-text document.
{
"title": "Meow mix",
"content": "[]"
}
Good response:
{
"workspaceId": "idmontie@gmail.com",
"id": "694f9a2b-fbe0-4452-a3b7-558e7b1d0939",
"title": "Meow mix",
"content": "[]",
"createdAt": "2019-10-29T02:43:16.964Z",
"updatedAt": "2019-10-29T02:43:16.965Z"
}
Get a specific interview by it's ID.
Authorization: See authorization
{
"workspaceId": "idmontie@gmail.com",
"id": "694f9a2b-fbe0-4452-a3b7-558e7b1d0939",
"updatedAt": "2019-10-29T02:43:16.965Z",
"content": "[]",
"title": "My title",
"createdAt": "2019-10-29T02:43:16.964Z"
}
Update an existing interview by its ID. This endpoint can be hit many times in a row while the user is editing their rich-text content.
Authorization: See authorization
{
"workspaceId": "idmontie@gmail.com",
"id": "694f9a2b-fbe0-4452-a3b7-558e7b1d0939",
"updatedAt": "2019-10-29T02:43:16.965Z",
"content": "[{ \"type\": \"text\", \"content\": \"Hello\" }]",
"title": "My title",
"createdAt": "2019-10-29T02:43:16.964Z"
}
Delete an interview by its ID. This returns the deleted item.
Authorization: See authorization
{
"workspaceId": "idmontie@gmail.com",
"id": "694f9a2b-fbe0-4452-a3b7-558e7b1d0939",
"updatedAt": "2019-10-29T02:43:16.965Z",
"content": "[{ \"type\": \"text\", \"content\": \"Hello\" }]",
"title": "My title",
"createdAt": "2019-10-29T02:43:16.964Z"
}