Categories:
Aura Terms and Conditions API
Description of Aura Terms and Conditions API
Introduction
Temporary implementation of the Kernel TermsAndConditions API.
This is an internal, privileged API that allows Aura to save the user’s acceptation.
As this API is not inside any secured deployment, an x-api-key header should be sent in every request.
This service is available in all the deployments with services needing Terms and Conditions handling, such as WhatsApp
Acceptance criteria
- There may be different versions for the service T&C.
- Only acceptations, not revocations, should be stored.
- There should be a way to allow deleting all acceptations for a user.
Database schema
Terms and Conditions database contains the services collection with the following structure:

API
Create an acceptation for a service version T&C POST /v0/users/:user_id/services
POST /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services
Content-Type: application/json
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
{
"version": "1",
"name": "aura"
}
HTTP/1.1 201 Created
Content-Type: application/json
{
"user_id": "9a47b037-825f-4ae7-bf55-6290efd5d036",
"name": "aura",
"version": "1",
"status": "accepted",
"created_at": "2019-08-08T15:19:48.259Z"
}
List user acceptations GET /v0/users/:user_id/services
GET /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"user_id": "9a47b037-825f-4ae7-bf55-6290efd5d036",
"name": "aura",
"version": "1",
"status": "accepted",
"created_at": "2019-08-08T15:19:48.259Z"
}
]
get specific user acceptation GET /v0/users/:user_id/services/:name/:version
GET /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services/aura/1
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
HTTP/1.1 200 OK
Content-Type: application/json
{
"user_id": "9a47b037-825f-4ae7-bf55-6290efd5d036",
"name": "aura",
"version": "1",
"status": "accepted",
"created_at": "2019-08-08T15:19:48.259Z"
}
delete all user acceptations DELETE /v0/users/:user_id/services
DELETE /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
HTTP/1.1 204 No Content
Create an entry with custom status for a service version T&C POST /v0/users/:user_id/services/:status
POST /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services/pending
Content-Type: application/json
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
{
"version": "1",
"name": "aura"
}
HTTP/1.1 201 Created
Content-Type: application/json
{
"user_id": "9a47b037-825f-4ae7-bf55-6290efd5d036",
"name": "aura",
"version": "1",
"status": "pending",
"created_at": "2019-08-08T15:19:48.259Z"
}
Update an entry with custom status for a service version T&C PUT /v0/users/:user_id/services/:status
PUT /v0/users/9a47b037-825f-4ae7-bf55-6290efd5d036/services/newStatus
Content-Type: application/json
x-api-key: 58e76225-d275-495b-a232-fdf3364ac277
{
"version": "1",
"name": "aura"
}
HTTP/1.1 201 Created
Content-Type: application/json
{
"n": 1,
"nModified": 1,
"ok": 1
}
Metrics
prometheus
GET /metrics
HTTP/1.1 200 OK
...txt...
liveness prove
GET /ping
HTTP/1.1 200 OK
Content-Type: application/json
{
"timestamp": 1567693845103,
"uptime": 7026,
"service": {
"name": "tac",
"version": "1.0.5"
}
}
Development
docker-compose up
To clean database and start from scratch
docker-compose down -v
Configuration
The configuration comes from environment variables.
# the mongodb uri, including user/password and ssl configuration
export TAC_MONGODB_URI=mongodb://db:27017/tac
# API key that should be sent in every request in the `x-api-key` header
export TAC_APIKEY=58e76225-d275-495b-a232-fdf3364ac277