Xapi Service

API V2 reference

This page applies to SCORM Cloud API V2. If you're looking for our V1 api reference see here

Xapi Service


This service provides a simple interface to add and manage xAPI statement 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, create a pipe using the createStatementPipe method.

Here is an example of the JSON object that you would send:

{
    "source": {
        "url": "https://cloud.scorm.com/RusticiEngine/lrs/{SOURCE_APP_ID}/statements",
        "userName": "lrs_user",
        "password": "lrs_user_password"
    },
    "target": {
        "url": "https://cloud.scorm.com/RusticiEngine/lrs/{DEST_APP_ID}",
        "userName": "other_user",
        "password": "other_password"
    }
}

There are 3 possible use cases of xAPI statement pipes, they are:

  • Cloud Application to Cloud Application: For this you need to ensure that the source.url is pointed to the /statements endpoint, but the target.url is pointed to the base /lrs endpoint (with any extra endpoint information).
  • Cloud Application to remote LRS: Ensure the source.url is configured as above, target.url pointed at the remote LRS.
  • Remote LRS to Cloud Application: To pipe statements from an external source into SCORM Cloud’s LRS, then the target.url should be pointing to SCORM Cloud and specify the application id, like it is in the example.


createStatementPipe

POST /xapi/statementPipes

Summary

Create an xAPI statement pipe.

Parameters

Consumes: application/json

Type Name Required Schema
Body xapiStatementPipe true XapiStatementPipePostSchema

Responses:

Produces: application/json

HTTP Code Description Schema
200 StringResultSchema
400 bad request, xapiPipe is not XapiPipePostSchema MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH write:xapipipe
write




createXapiCredential

POST /xapi/credentials

Summary

Create a xAPI credential.

Parameters

Consumes: application/json

Type Name Required Schema
Body xapiCredential true XapiCredentialPostSchema

Responses:

Produces: application/json

HTTP Code Description Schema
200 StringResultSchema
400 bad request, xapiCredentials is not XapiCredentialsPostSchema MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH write:xapicredential
write




deleteStatementPipe

DELETE /xapi/statementPipes/{statementPipeId}

Summary

Caution: avoid re-creating a pipe with the same ID quickly after a delete. The old version could still be processing, in which case the new pipe could be updated improperly by the processor.

Parameters

Consumes: application/json

Type Name Required Schema
Path statementPipeId true String

Responses:

Produces: application/json

HTTP Code Description Schema
204
404 xapiPipeId not found MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH delete:xapipipe
delete




deleteXapiCredential

DELETE /xapi/credentials/{xapiCredentialId}

Summary

Deletes the xAPI credentials specified by the xAPI credentials id

Parameters

Consumes: application/json

Type Name Required Schema
Path xapiCredentialId true String

Responses:

Produces: application/json

HTTP Code Description Schema
204 The xAPI credential with id xapiCredentialsId was deleted
404 xapiCredentialsId not found MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH delete:xapicredential
delete




getStatementPipe

GET /xapi/statementPipes/{statementPipeId}

Summary

Retrieves xAPI pipe for xapiPipeId

Parameters

Consumes: application/json

Type Name Required Schema
Path statementPipeId true String

Responses:

Produces: application/json

HTTP Code Description Schema
200 The specified xAPI pipe XapiStatementPipeSchema
404 xapiPipeIdnot found MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH read
read:xapipipe




getStatementPipes

GET /xapi/statementPipes

Summary

Get all of the xapiPipes for appId

Responses:

Produces: application/json

HTTP Code Description Schema
200 A list of xAPI pipes XapiStatementPipeListSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH read
read:xapipipe




getXapiCredential

GET /xapi/credentials/{xapiCredentialId}

Summary

Retrieves the xAPI credentials specified by the xAPI credentials id.

Parameters

Consumes: application/json

Type Name Required Schema
Path xapiCredentialId true String

Responses:

Produces: application/json

HTTP Code Description Schema
200 The specified xAPI credentials XapiCredentialSchema
404 xapiCredentialsId not found MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH read
read:xapicredential




getXapiCredentials

GET /xapi/credentials

Summary

Get the list of xapiCredentials

Parameters

Consumes: application/json

Type Name Required Schema
Query since false Date
Query more false String

Responses:

Produces: application/json

HTTP Code Description Schema
200 A list of xAPI credentials XapiCredentialsListSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH read
read:xapicredential




setStatementPipe

PUT /xapi/statementPipes/{statementPipeId}

Summary

Editing a pipe will cause it to start over and forward any statements it finds, even if the prior version of the pipe had already forwarded those statements. If the pipe being edited is currently being processed, the this request will fail with a status code of 409.

Parameters

Consumes: application/json

Type Name Required Schema
Path statementPipeId true String
Body xapiStatementPipe true XapiStatementPipePutSchema

Responses:

Produces: application/json

HTTP Code Description Schema
200 StringResultSchema
400 bad request, xapiPipe is not XapiPipeSchema MessageSchema
409 conflict, pipe is currently being processed MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH write:xapipipe
write




setXapiCredential

PUT /xapi/credentials/{xapiCredentialId}

Summary

Edit an existing xAPI credential or create a new one, specified by the xAPI credentials id

Parameters

Consumes: application/json

Type Name Required Schema
Path xapiCredentialId true String
Body xapiCredential true XapiCredentialPostSchema

Responses:

Produces: application/json

HTTP Code Description Schema
204 The creation or edit of the xAPI credential was successful
400 bad request, xapiCredentials is not XapiCredentialsPostSchema MessageSchema

Authentication:

Type Name Scopes
basic APP_NORMAL
oauth2 OAUTH write:xapicredential
write