xAPI

The edcast xAPI endpoint enables LMS systems & Content providers to push completions events to edcast for content that has been created via Integrations.

Procuring Credentials

  • Admin will generate OAuth 2 Credentials from the Admin UI for the specific source.
  • Admin UI will allow the creation of only 1 OAuth credentials per source. Admin will need to delete an older credentials pair before regenerating a
    new one for the same source.

Login into the Org Admin. Navigate to Integrations > OAuth 2 Apps
To create credentials for a source , click Create. Select the source & enter a display name




The Client Id & Client Secret are displayed in the table . Hover on the Client Id to get the Client Secret


API Details

Authentication

The client needs to use two-legged OAuth 2.0 to send authenticated POST requests. Two-legged OAuth is also known as OAuth 2.0 Client Credentials,
Grant. Edcast is the authorization server.

  • URL
    {{lxp_host_name}}/api/lrs/v1/xapi/oauth2/token

  • Method
    POST

  • Body (x-www-form-urlencoded)

KeyDescriptionValue
grant_typeclient_credentials
scopexapi:write
client_idValue to be obtained from Edcast for that source
client_secretValue to be obtained from Edcast for that source
  • Sample Response

{
   "access_token":"AUTH_TOKEN_FROM_AUTHENTICATION_API_RESPONSE",
   "token_type":"bearer",
   "expires_in":3600
}

Activity Statement

A learner activity webhook POST body follows an Actor, Verb, Object data model.

  • URL
    {{lxp_host_name}}/api/lrs/v1/xapi/statements

  • Method
    POST

  • Headers

Header NameValue
Acceptapplication/json
Content-Typeapplication/json
AuthorizationBearer AUTH_TOKEN_FROM_AUTHENTICATION_API_RESPONSE

{
   "actor":{
      "mbox":"mailto:[email protected]",
      "objectType":"Agent",
   },
   "verb":{
      "display":{
         "en-US":"COMPLETED"
      },
      "id":"http://adlnet.gov/expapi/verbs/completed"
   },
   "object":{
      "definition":{
         "type":"http://adlnet.gov/expapi/activities/course",
         "name":{
            "en-US":"title of object"
         }
      },
      "id":"course_id",
      "objectType":"Activity"
   },
   "timestamp":"2018-09-17T19:13:27.384Z"
}

We also support user profile "external_id" as actor identifier. Sample code is as follows

{
   "actor":{
      "openid":"<EdCast Profile external_id>", 
      "objectType":"Agent"
   },
   "verb":{
      "display":{
         "en-US":"COMPLETED"
      },
      "id":"http://adlnet.gov/expapi/verbs/completed"
   },
   "object":{
      "definition":{
         "type":"http://adlnet.gov/expapi/activities/course",
         "name":{
            "en-US":"title of object"
         }
      },
      "id":"course_id",
      "objectType":"Activity"
   },
   "timestamp":"2018-09-17T19:13:27.384Z"
}

Supported VERB IDS

verb.id ( Line 10 ) in the above JSON body supports the below

For Complete Event:

"http://adlnet.gov/expapi/verbs/completed"
"http://activitystrea.ms/schema/1.0/complete"
"http://activitystrea.ms/schema/1.0/approve"
"http://activitystrea.ms/schema/1.0/close"
"http://adlnet.gov/expapi/verbs/passed"

For Start Event:

"http://adlnet.gov/expapi/verbs/started"
"http://activitystrea.ms/schema/1.0/start"
"http://adlnet.gov/expapi/verbs/answered"
"http://adlnet.gov/expapi/verbs/attempted"
"http://activitystrea.ms/schema/1.0/assign"
"http://adlnet.gov/expapi/verbs/progressed"
"http://activitystrea.ms/schema/1.0/consume"
"http://activitystrea.ms/schema/1.0/join"


API Responses For Error Conditions

  • API requests with invalid / expired / deleted credentials will be returned with HTTP status 401 unauthorised & should not modify any data.
  • Throttling Limitations per org will apply & respond with HTTP status 429 & A Retry-After header will be included to this response indicating how
    long to wait before making a new request
    • Default 10 Request per 10 seconds per organization
  • If content with the external Id or the user with the given email id / lms_id is not found, HTTP status 422 (bad request) will be returned with an
    appropriate message

Screenshots

Before the Completion Event is received , the card does not display a green tick (which indicates that it is not completed)



After the completion event is received,

  • The card displays a green tick (which indicates that it is completed)
  • Me > My Dashboard > Activity lists tat the card has been completed
  • Me > My Content > Completed also lists the card




Postman Collections

XAPI Environment Variables.postman_environment.json

XAPI Edcast.postman_collection.json


Limitations

The xAPI endpoint cannot be used to push the completions for

  • User Generated Content ( since UGCs do not have a external Id)

© 2020 EdCast Inc.