Data API
Introduction
The Data API covers several groups of sub-APIs.
6 xAPI data exploration APIs:
- The Statements API
- The Activities API
- The Agents API
- The Activity Profiles API
- The Agents Profiles API
- The States API
5 xAPI vocab exploration API:
- The Verbs API
- The Activity Types API
- The Activity IDs API
- The Agent IDs API
- The Document IDs API
1 persons management API:
- The Persons API
Getting access to the API
The Data API is enabled globally by default, and can be disabled with the DATA_API config option set to false.
It is fully accessible to all the clients which have the data/all permission enabled.
The API endpoints rely on the store endpoint of each client.
In this documentation, we will designate the store endpoint by <store-endpoint>.
To get the store endpoint of a client:
- Go to the
Access > API Consumers > Clientspage. - Click on the
(i)icon of a client. - The endpoint is indicated next to the
Store endpointlabel.
Statements API
Getting statements
Use the GET method on <store-endpoint>/statements with the following optional params:
| Param | Description |
|---|---|
| agent | JSON encoded xAPI agent |
| verb | Full IRI of a verb |
| activity | Full IRI of an activity |
| since | ISO 8601 date |
| until | ISO 8601 date |
| type | Full IRI of an activity type |
| profile | Full IRI of an xAPI profile |
| pseudonymized | Boolean |
| voided | Boolean |
| rearrange | Boolean. Use it to rearrange the order of the statement properties in a more readable way. |
| agent_location | String: actor, object, everywhere. Where to search the specified agent. |
| activity_location | String: object, everywhere. Where to search the specified activity. |
Activities API
Getting activities
Use the GET method on <store-endpoint>/activities with the following optional params:
| Param | Description |
|---|---|
| activityId | Full IRI of an activity |
| type | Full IRI of an activity type |
| is_category | Boolean. Set to true to get only activities which have been identified as a statement category. |
| is_profile | Boolean. Set to true to get only activities which have been identified as an xAPI profile. |
| rearrange | Boolean. Use it to rearrange the order of the activity properties in a more readable way. |
Agents API
Getting agents
Use the GET method on <store-endpoint>/agents with the following optional params:
| Param | Description |
|---|---|
| agent | JSON encoded xAPI agent |
| type | String: all, agents, groups, groups_with_members |
| sid_type | String: mbox, mbox_sha1sum, openid, account |
| location | String: all, agent, group, member. Where to search the agent. |
| join_members | Boolean. Set to true to join members when the agent is a group. |
Activity Profiles API
Getting activity profiles
Use the GET method on <store-endpoint>/activity-profiles with the following optional params:
| Param | Description |
|---|---|
| profileId | String |
| activityId | Full IRI of an activity |
| since | ISO 8601 date |
| type | MIME type |
Agents Profiles API
Getting agent profiles
Use the GET method on <store-endpoint>/agent-profiles with the following optional params:
| Param | Description |
|---|---|
| profileId | String |
| agent | JSON encoded xAPI agent |
| since | ISO 8601 date |
| type | MIME type |
States API
Getting states
Use the GET method on <store-endpoint>/states with the following optional params:
| Param | Description |
|---|---|
| stateId | String |
| agent | JSON encoded xAPI agent |
| activityId | Full IRI of an activity |
| registration | UUID |
| since | ISO 8601 date |
| type | MIME type |
Verbs API
Getting verbs
Use the GET method on <store-endpoint>/verbs with the following optional params:
| Param | Description |
|---|---|
| in_iri | String to be searched in the verb IRI |
Activity Types API
Getting activity types
Use the GET method on <store-endpoint>/activity-types with the following optional params:
| Param | Description |
|---|---|
| in_iri | String to be searched in the activity type IRI |
Activity IDs API
Getting activity IDs
Use the GET method on <store-endpoint>/activity-ids with the following optional params:
| Param | Description |
|---|---|
| in_iri | String to be searched in the activity IRI |
| is_category | Boolean. Set to true to get only activities which have been identified as a statement category. |
| is_profile | Boolean. Set to true to get only activities which have been identified as an xAPI profile. |
Agent IDs API
Getting agent IDs
Use the GET method on <store-endpoint>/agent-ids with the following optional params:
| Param | Description |
|---|---|
| sid_type | String: mbox, mbox_sha1sum, openid, account |
| in_sid_field_1 | String to be searched in the agent ID, or in the name prop if the agent has the account format. |
| in_sid_field_2 | String to be searched in the homePage prop if the agent has the account format. |
Document IDs API
Getting document IDs
Use the GET method on <store-endpoint>/document-ids with the following optional params:
| Param | Description |
|---|---|
| in_name | String to be searched in the document name (profileId or stateId) |
| in_type | String to be searched in the document MIME type |
| mime_type | MIME type of the document |
| doc_type | String: activity-profile, agent-profile, state |
Persons API
Updating persons
Use the POST method on <store-endpoint>/persons.
The body must be a JSON content which takes the form of a list of persons, each person being a list of agents.
For example:
[
[
{
"mbox": "mailto:john@doe.com"
},
{
"openid": "http://openid.com/john-doe"
},
],
[
{
"mbox": "mailto:jack@white.com"
},
{
"account": {
"name": "jack.white",
"homePage": "http://my-lms.com"
}
},
],
]
Getting a person
Use the GET method on <store-endpoint>/persons with the following required param:
| Param | Description |
|---|---|
| agent | JSON encoded xAPI agent |
The request will return the list of the agents of the specified person in a linear way. For example:
{
"data": [
{
"name": "John Doe",
"mbox": "mailto:john@doe.com"
},
{
"openid": "http://openid.com/john-doe"
},
]
}