Statement Metadata API HTTP Interface
The routes table below describes the methods that the Statement Metadata HTTP interface provides. Both routes require that you specify an _id
from the statement record, in order to determine to which statement the metadata should be added. This can be found be found by performing a GET request on the statement model.
Code Block |
---|
POST http://www.example.org/api/v2/statementmetadata/:id |
...
Code Block |
---|
{ "https://learninglocker.net/true-false-response": "Yes" } |
Schema
Name | Description --- | --- | --- _id | The unique id of the Statement metadata | An object containing key-value pairs, where the key is an IRI representing the metadata field with requirements defined by the xAPI specification and the value can be of any type.
Routes
Method | Description |
---|---|
Patches a model. | |
Creates or overwrites a model. |
PATCH /:id
This route patches the metadata field on a statement that has the specified statement _id from the URL. A request to this route would look something like the request below.
...
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "_id": "111aaa1111a111111aa11111", "metadata": { "example_key": "example_value" } } |
POST /:id
This route creates or updates the metadata field on a statement that has the specified statement identifier from the URL.
Please note:
It is preferable to use PATCH where possible to prevent overwriting metadata set by Learning Locker that is required for certain parts of the UI to work.
...
Code Block |
---|
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "_id": "111aaa1111a111111aa11111", "metadata": { "example_key": "example_value" } } |
GET statement _id
To get the statement _id for the route above, we can perform a GET request on statements via the REST API.
...
This _id
is then used to add statement metadata via the PATCH and POST routes.