Create Schema
This model is part of an upcoming API update which is currently in beta and therefore subject to change.
POST https://ed.link/api/v2/audit/schemas
Create the Schema for a given action.
It is recommended to create a Schema before sending Events, so that validation of events can be more usefully performed.
This endpoint creates a new Schema and returns a 409 Conflict error if a Schema for the given action.id already exists.
To update an existing Schema, use PATCH /schemas/:identifier.
The response contains the version UUID of the Schema for that action.
Events are associated with the most recent Schema with a matching action, and will list their version in the event.
Properties
The following properties can be defined by the user in a Schema:
| Property | Type | Required | Description |
|---|---|---|---|
action | object | Required | An object with id (the action string identifier, e.g. assignment.submit) and type (see more). |
validation_level | string | Optional | One of strict or lax. Defaults to lax. |
data | object | Optional | Any valid JSON Schema object describing the shape of your custom data data. |
The following properties are additionally present when fetching a Schema:
| Property | Type | Description |
|---|---|---|
version | string | The UUID identifying this specific version of the Schema associated with this action |
created_date | date | When this Schema was defined |
id | string | UUID for fetching Schema details |
Request Body
The request body should contain a Schema object. Each field is described below.
action (Required)
You must specify the action. It identifies which Events this Schema governs.
{
"action": {
"id": "assignment.submit",
"type": "create"
}
}
id: your action string identifier, such asassignment.submit.type: one ofcreate,read,update,delete, orother.
validation_level (Optional)
Dictates what Edlink does with non-conforming Events. One of strict or lax. Defaults to lax if unspecified.
{
"validation_level": "strict"
}
data (Optional)
Any valid JSON Schema object can be placed here to define the shape of your custom data object.
Other Event Properties (Disallowed)
No other Event properties (actor, targets, scope, context) are controllable by a Schema. Edlink validates those fields against its own built-in expectations — see the Event documentation.
Sample Request
axios.post('https://ed.link/api/v2/audit/schemas', {
headers: {
authorization: `Bearer ${integration_access_token}`
},
data: {
action: {
id: 'assignment.submit',
type: 'create'
},
validation_level: 'strict',
data: {
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://example.com/product.schema.json',
title: 'Product',
description: "A product from Acme's catalog",
type: 'object',
properties: {
productId: {
description: 'The unique identifier for a product',
type: 'integer'
},
productName: {
description: 'Name of the product',
type: 'string'
},
price: {
description: 'The price of the product',
type: 'number',
exclusiveMinimum: 0
}
},
required: ['productId', 'productName', 'price']
}
}
});
Sample Response
The response contains the full Schema object.
{
"$request": "00000000-0000-0000-0000-000000000000",
"$data": {
"id": "00000000-0000-0000-0000-000000000000",
"created_date": "2021-07-13T17:45:39.937Z",
"version": "00000000-0000-0000-0000-000000000000",
"validation_level": "strict",
"action": {
"id": "assignment.submit",
"type": "create"
},
"data": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"productId": {
"description": "The unique identifier for a product",
"type": "integer"
},
"productName": {
"description": "Name of the product",
"type": "string"
},
"price": {
"description": "The price of the product",
"type": "number",
"exclusiveMinimum": 0
}
},
"required": [ "productId", "productName", "price" ]
}
}
}