Statement Resource
Manages learner statements.
sendStatement
Sends a statement to the LRS.
Examples
Example 1: Send Basic Statement
Example 2: Send Embedded Attachment Statement
This example requires CryptoJS to generate a sha2 of the attachment data and convert the array buffer to a word array.
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing a string array of statement IDs if successful, or if unsuccessful the rejection contains an error message.
sendStatements
Sends multiple statements to the LRS.
Example 1: Send Basic Statements
Example 2: Send Embedded Attachment Statements
This example requires CryptoJS to generate a sha2 of the attachment data and convert the array buffer to a word array.
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing a string array of statement IDs if successful, or if unsuccessful the rejection contains an error message.
getStatement
To receive a single statement, you must use the getStatement
method and pass the statement ID in the query. Optionally, you can provide additional parameters to the query to change the data format returned from the LRS.
Examples
Example 1: Get Basic Statement
Example 2: Get Embedded Attachment Statement
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing the Statement of the supplied statementId
.
When getting a statement with attachments: true
, the success data
is returned as an array. The first array item is of type Statement
, and the following are of type Part
and are the attachments supplied with the statement.
getStatements
To receive an array of statements based upon a query, you must use the getStatements
method. See the GetStatementsQuery interface for a full list of ways to create your query.
Example
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing a StatementsResponse object.
When getting statements with attachments: true
, the success data
is returned as an array. The first array item is of type StatementsResponse
, and the following are of type Part
and are the attachments supplied with the statement.
getMoreStatements
To be used in conjunction with getStatements
. If the more
property is populated on your initial request, more data is available. Send the value of the more
property to this method to get the next page of statements.
Example
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing a StatementsResponse object or an Array containing StatementsResponse
and Part
if the original query has attachments: true
. When working in TypeScript you may need to cast your result.data
return type explicitly as StatementsResponse
or StatementsResponseWithAttachments
.
voidStatement
Voids a statement in the LRS by the supplied Actor.
Example
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing an array of statement ID strings of the void statement.
voidStatements
Voids multiple statements in the LRS by the supplied Actor.
Example
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing an array of statement ID strings of the void statements.
getVoidedStatement
To receive a single voided statement, you must use the getVoidedStatement
method and pass the original statement ID in the query (not the original statement's void statement id). Optionally, you can provide additional parameters to the query to change the data format returned from the LRS.
Example
Parameters
Returns
This method returns an AxiosPromise
with the success data
containing the Statement of the supplied voidedStatementId
.
When getting a statement with attachments: true
, the success data
is returned as an array. The first array item is of type Statement
, and the following are of type Part
and are the attachments supplied with the statement.
Last updated