xApiConnector Class Reference

Using the methods listed below, you can create complex xAPI statements. The class also provides a valuation method, as well as synchronous and asynchronous send methods.

Statement partMethod nameParametersDescription
ActorsetActorName(String name)Set actor.name field in statement.
setActorAccount(String name, String homePage)Set actor.account object in statement. *
setActorMbox(String mbox)Set actor.mbox field in statement.*
setActorMboxSha1Sum(String mbox_sha1sum)Set actor.mbox_sha1sum field in statement.*
setActorOpenId(String openid)Set actor.openid field in statement.*
NOTE: Only one of these identifiers can be set in a statement. Each method will clear out any other actor identifiers when called to ensure this XAPI requirement is met.
VerbsetVerbId(String id)Set verb.id field in statement.
setVerbDisplay(String text)Set verb.display object in statement.
ObjectsetObjectId(String id)Set object.id field in statement.
setObjectName(String text)Set object.definition.name object in statement.
setObjectDescription(String text)Set object.definition.description object in statement.
addObjectExtension(String key, Object value)Add an object.definition.extensions key/value pair to the statement.
setObjectType(String type)Set object.definition.type field in statement.
setObjectMoreInfo(String moreInfo)Set object.definition.moreInfo field in statement. This field must be an IRI.
ContextaddContextActivityxApiStatementObject activityAdd a context activity object to the statement.
addContextExtension(String key, Object value)Add a context.extensions object to the statement.
setContextLanguage(String language)Set context.language field in statement.
setContextPlatform(String platform)Set context.platform field in the statement.
setContextRevision(String revision)Set context.revision field in the statement.
setContextStatement(Map<String, Object> statement)Set context.statement object to the statement.
setContextInstructorxApiStatementAgent instructorSet context.instructor object in the statement.
setContextRegistration(String registration)Set context.registration field in the statement.
ResultaddResultExtension(String key, Object value)Add a result.extensions key/value pair to the statement.
setResultCompletion(Boolean completion)Set result.completion field in the statement.
setResultDuration(String duration)Set result.duration field in the statement.
setResultResponse(String response)Set result.response field in the statement.
setResultSuccess(Boolean success)Set result.success field in the statement.
setScoreMax(Double max)Set result.score.max field in the statement.
setScoreMin(Double min)Set result.score.min field in the statement.
setScoreRaw(Double raw)Set result.score.raw field in the statement.
setScoreScaled(Double scaled)Set result.score.scaled field in the statement.
setAuthorityxApiStatementAgent authoritySet authority object in the statement (note: must be a valid map equivalent to an xapi agent.
setVersion(String version)Set version field in the statement.
(All)setData(GxsXapiParams params)To set data for the required statement, passing in a set of parameters via an instance of the exposed class GxsXapiParams.
(All)validate0To check the statement data as provided for validity (before sending).

Returns: Boolean
(All)sendSync0To send the statement (if valid, validity is checked before the send is attempted) to the LRS as configured in a synchronous manner – i.e. get a return value (Boolean) which determines whether the statement was sent successfully or not.

Returns: Boolean
(All)sendAsync0To send the statement (if valid, validity is checked before the send is attempted) to the LRS as configured in an asynchronous manner – i.e. in a separate thread, at which time control is passed immediately back to the calling code.

Returns: Boolean
xApiStatementAgent Classs (MetaXapi.XapiStatementAgent)
Method nameParametersDescription
setName(String name)Set agent name field
setMbox(String mbox)Set agent mbox field
setMboxSha1Sum(String mboxsha1sum)Set agent mbox_sha1sum field
setOpenId(String openid)Set agent openid field
setAccount(String name, String homePage)Set agent account field
xApiStatementObject Class (MetaxAPI.XapiStatementObject)
Method nameParametersDescription
setId(String id)Set object id
setName(String name)Set object name
setDescription(String description)Set object description
setType(String type)Set object type

More Information

For more information and implementation details, browse the documentation below:

Setting up Globebyte xAPI Send xAPI from a flow Form action fields Send xAPI from Apex Logging and defaults xAPI class connector reference