DXXAPIClient

This class is responsible for making requests to the xAPI API.

You will need to enable the "Training" scope for your app in the developer dashboard before using the xAPI API.

Properties

public static let shared: DXXAPIClient

Singleton instance of DXXAPIClient. You will access all the available DXXAPIClient methods through this instance.

Methods

createStatement

public func createStatement(
    actor: String,
    verb: String,
    object: [String: String],
    timestamp: String? = nil,
    _ completion: @escaping (_ error: Error?) -> Void
    ) -> Void

Creates an xAPI statement.

Parameter

Type

Description

actor

String

User ID of the actor performing the action.

verb

String

Action that the actor is carrying out on the object.

object

String

Targets of the action the user is carrying out.

timestamp

String?

A parseable ISO date (eg. 2020-01-07T21:45:35.649Z).

completion

(_ error: Error?) -> Void

The closure invoked when the request finishes. Called with an Error argument if the request fails.

There are a few keys you can attach to your object to ensure your statement is indexed to other DX objects:

  • lessonId: this statement is part of a specific lesson.

  • classId: this statement happened in a specific class.

  • lessonResultId: this statement is part of a specific lesson result.

See Tips for MOTAR Integration for example implementation code snippet

Last updated