xAPI Pipes
xAPI statement pipes provide the means to automatically transfer statements from one LRS to another. Applications include:
- forwarding for users who wish to have their statements stored in their own Personal Data Lockers (PDLs)
- replicating production data in a sandbox LRS
- pulling data in from a remote LRS
In order to use statement pipes, set xAPIStatementPipeEnabled
to true
in your Engine settings file, and then create a pipe using the xapi/statementPipes resource on the API.
Here is an example of the JSON object that you would send when piping statements out of your Engine instance to an external system. We leave out the source
property, so that it just pulls directly from Engine internally. Statements will be pulled from the tenant specified by the engineTenantName
header and then forwarded to the LRS indicated by the target
.
{
"target": {
"url": "http://example.net/other-system/lrs",
"userName": "username",
"password": "password"
}
}
In this example, we include a source
property so that it pipes from one LRS to another. The source.url
must point to the /statements
resource of your source LRS. On the other hand, target.url
must point to the base resource of the target LRS with any extra endpoint information. For example, if an Engine instance is the target, then the target.url
should be the /lrs
resource. If you want to pipe statements from an external source into Engine's LRS, then the target.url
should be pointing to Engine and specify the tenant name, like it is in the example. In both cases, the tenant name is optional; if you do not specify a tenant, then all of the statements will be inserted into the default tenant's LRS.
{
"source": {
"url": "http://example.com/RusticiEngine/lrs/tenant-name/statements",
"userName": "lrs_user",
"password": "lrs_user_password"
},
"target": {
"url": "http://example.net/RusticiEngine/lrs/other-tenant",
"userName": "cloud_username",
"password": "cloud_password"
}
}
Please note that when Engine is posting statements to the target
endpoint, it will add /statements
to the url, as defined by the xAPI spec. If you are targeting a non-xAPI-compliant system (e.g., a BI tool or custom API), then it will need to have an endpoint named like this for Engine to be able to post to it.