Update Schema
This model is part of an upcoming API update which is currently in beta and therefore subject to change.
PATCH https://ed.link/api/v2/audit/schemas
Update an existing Schema for a given action.
Only the fields you include in the request body will be changed. Omitted fields are left as-is.
If the Schema does not exist, a 404 Not Found error is returned.
To create a new Schema, use POST /schemas.
Each successful update closes the current version and opens a new one, issuing a fresh version UUID.
Events are associated with the most recent Schema with a matching action at the time they are received.
Parameters
One of these parameters MUST be present in the JSON request body, in order to identify which Schema you are attempting to create a new version of.
| Parameter | Type | Description |
|---|---|---|
action | string | The action identifier whose Schema you want to update, e.g. assignment.submit. |
| or | ||
schema_id | string | The UUID of the specific Schema version you want to update. |
Updateable Properties
All fields are optional. Only fields present in the body are applied. Values from the previous version of the Schema will be retained if not specified.
| Property | Type | Description |
|---|---|---|
action_type | string | One of create, read, update, delete, or other. Updates the type associated with this action. |
validation_level | string | One of strict or lax. |
data | object | Any valid JSON Schema object describing the shape of your custom data. Replaces the previous value entirely. |
Sample Request
axios.patch('https://ed.link/api/v2/audit/schemas', {
headers: {
authorization: `Bearer ${integration_access_token}`
},
data: {
action: 'assignment.submit',
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 updated Schema object with a new version UUID.
{
"$request": "00000000-0000-0000-0000-000000000000",
"$data": {
"id": "00000000-0000-0000-0000-000000000000",
"created_date": "2021-07-13T17:45:39.937Z",
"version": "11111111-1111-1111-1111-111111111111",
"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" ]
}
}
}