Skip to main content

Datastore API (0.1.0)

Download OpenAPI specification:Download

License: MIT

Example of documentation available out-of-the-box from the Datastore with one managed entity Account

Accounts

Routes available for the model Account

Events available to this model: CREATED, UPDATED, PATCHED, ARCHIVED, DELETED, RESTORED, ROLLBACKED.

Account JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "version",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "account_id": {
      "type": "string",
      "description": "Unique ID used as a correlation ID",
      "example": "5fa962406a651140b5f9f4bf"
    },
    "is_enabled": {
      "type": "boolean",
      "description": "Boolean indicating the enabling state of the entity",
      "example": true
    },
    "auth": {
      "type": "string",
      "description": "Authentication token"
    },
    "email": {
      "type": "object",
      "description": "`encrypted` Account email of the user",
      "properties": {
        "hash": {
          "type": "string",
          "description": "Hash value",
          "example": "b8cccea15437aef415090bda6acb3b0ad3d4cf7d3e4cf816772e4b43e8f9d08af392bb98b8d532e07249f0d1304e6d65e007205c39913ee5db95578be398f4bd"
        },
        "encrypted": {
          "type": "string",
          "description": "Encrypted value",
          "example": "03d72e:1e9f1a960adfd0815530f7133c97dcd2:648b63622bb5bc3145de4d3f15fe05651ebdedbeab1d11986538214c4a25b834"
        }
      }
    },
    "email_verification_token": {
      "type": "string",
      "description": "Verification token for a newly registerd email",
      "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "pattern": "^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?$"
    },
    "is_email_verified": {
      "type": "boolean",
      "description": "Is the email verified",
      "example": false
    },
    "reset_password_uuid": {
      "type": "string",
      "description": "Unique ID to use to reset the password",
      "example": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "pattern": "^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})?$"
    },
    "reset_password_expires_by": {
      "type": "string",
      "description": "Reset password request expiration date",
      "example": "2019-01-01T00:00:00.000Z",
      "format": "date-time"
    },
    "version": {
      "type": "integer",
      "description": "Event history version",
      "example": 0,
      "minimum": 0
    },
    "created_at": {
      "type": "string",
      "description": "ISO 8601 date format",
      "example": "2019-01-01T00:00:00.000Z",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "description": "ISO 8601 date format",
      "example": "2019-01-01T00:00:00.000Z",
      "format": "date-time"
    }
  }
}

Create a new Account

Create a new Account in the database.

Authorizations:
apiKey
Request Body schema: application/json
account_id
string

Unique ID used as a correlation ID

is_enabled
boolean

Boolean indicating the enabling state of the entity

auth
required
string

Authentication token

email
required
string <email>

Account email of the user

email_verification_token
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Verification token for a newly registerd email

is_email_verified
boolean

Is the email verified

reset_password_uuid
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Unique ID to use to reset the password

reset_password_expires_by
string <date-time>

Reset password request expiration date

Responses

Request samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": "john@doe.org",
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z"
}

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Find Accounts

Find Accounts present in the database.

Authorizations:
apiKey
query Parameters
string or Array of strings or object

index Unique ID used as a correlation ID

boolean or Array of booleans or object or boolean or Array of booleans

Boolean indicating the enabling state of the entity

string or Array of strings or object or string or Array of strings

Authentication token

object or Array of objects or object or string or Array of strings

encrypted Account email of the user

string or Array of strings or object or string or Array of strings

Verification token for a newly registerd email

boolean or Array of booleans or object or boolean or Array of booleans

Is the email verified

string or Array of strings or object or string or Array of strings

Unique ID to use to reset the password

string or Array of strings or object or string or Array of strings

Reset password request expiration date

integer or Array of integers or object

Event history version

string or Array of strings or object

index ISO 8601 date format

string or Array of strings or object

index ISO 8601 date format

_q
string

MongoDb query in JSON stringified

_must_hash
boolean

Do we need to hash query values before find results if needed?

header Parameters
page
integer >= 0
Default: 0

Page index

page-size
integer [ 0 .. 1000 ]
Default: 100

Maximum page size

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Encrypt fields

Encrypt fields in Account.

Authorizations:
apiKey
Request Body schema: application/json
Array
account_id
string

Unique ID used as a correlation ID

is_enabled
boolean

Boolean indicating the enabling state of the entity

auth
string

Authentication token

object

encrypted Account email of the user

email_verification_token
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Verification token for a newly registerd email

is_email_verified
boolean

Is the email verified

reset_password_uuid
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Unique ID to use to reset the password

reset_password_expires_by
string <date-time>

Reset password request expiration date

version
integer >= 0

Event history version

created_at
string <date-time>

ISO 8601 date format

updated_at
string <date-time>

ISO 8601 date format

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
[
  • {
    }
]

Decrypt encrypted fields

Decrypt fields in Account.

Authorizations:
apiKey
Request Body schema: application/json
Array
account_id
string

Unique ID used as a correlation ID

is_enabled
boolean

Boolean indicating the enabling state of the entity

auth
string

Authentication token

object

encrypted Account email of the user

email_verification_token
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Verification token for a newly registerd email

is_email_verified
boolean

Is the email verified

reset_password_uuid
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Unique ID to use to reset the password

reset_password_expires_by
string <date-time>

Reset password request expiration date

version
integer >= 0

Event history version

created_at
string <date-time>

ISO 8601 date format

updated_at
string <date-time>

ISO 8601 date format

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
[
  • {
    }
]

Get all events

Get all events created for this kind of entities whatever the value of the correlation ID

Authorizations:
apiKey
header Parameters
page
integer >= 0
Default: 0

Page index

page-size
integer [ 0 .. 1000 ]
Default: 100

Maximum page size

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a Account

Get a specific Account uniquely identified by its account_id.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

Responses

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Update a Account

Update an existing Account already present in the database.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

Request Body schema: application/json
account_id
string

Unique ID used as a correlation ID

is_enabled
boolean

Boolean indicating the enabling state of the entity

auth
string

Authentication token

email
string <email>

Account email of the user

email_verification_token
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Verification token for a newly registerd email

is_email_verified
boolean

Is the email verified

reset_password_uuid
string^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f...

Unique ID to use to reset the password

reset_password_expires_by
string <date-time>

Reset password request expiration date

Responses

Request samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": "john@doe.org",
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z"
}

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Patch a Account

Patch an existing Account already present in the database.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

Request Body schema: application/json
required
Array of objects
Array
op
required
string
Enum: "add" "remove" "replace" "copy" "move"

JSON PATCH Operation

path
required
string

JSON PATCH Operation path

Responses

Request samples

Content type
application/json
{
  • "json_patch": [
    ]
}

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Get a Account events

Get all events attached to a Account.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

header Parameters
page
integer >= 0
Default: 0

Page index

page-size
integer [ 0 .. 1000 ]
Default: 100

Maximum page size

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create snapshot

Create a snapshot of a Account to keep a frozen version in database.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

Responses

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Get Account at version

Get a specific version for a Account.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

version
required
string
Default: "0"

Version

Responses

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Restore Account at version

Restore a specific version of the Account.

Authorizations:
apiKey
path Parameters
account_id
required
string
Example: 5fa962406a651140b5f9f4bf

Correlation id

version
required
integer
Default: 0

Version

Responses

Response samples

Content type
application/json
{
  • "account_id": "5fa962406a651140b5f9f4bf",
  • "is_enabled": true,
  • "auth": "string",
  • "email": {
    },
  • "email_verification_token": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "is_email_verified": false,
  • "reset_password_uuid": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  • "reset_password_expires_by": "2019-01-01T00:00:00.000Z",
  • "version": 0,
  • "created_at": "2019-01-01T00:00:00.000Z",
  • "updated_at": "2019-01-01T00:00:00.000Z"
}

Stream all changes

Stream all changes in the database such as creation or update.

path Parameters
model
required
string
Enum: "all" "internal_models" "_logs" "accounts"
Example: users

Model name

source
required
string
Enum: "entities" "events"
Example: entities

Data source to stream

query Parameters
output
string
Enum: "entity" "raw"
Example: output=entity

Expected output

Request Body schema: application/json
Array
object

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
[
  • {
    }
]