If you’re just getting started with the xAPI, there are a few things that you need to know when setting up your learning record store (LRS), and in particular, how to setup basic xAPI statements using the Actor > Verb > Object triplet.

In this post, we’ll be looking at the ‘Actor’ element – what it is, how it’s used and what correctly programmed statement anatomy looks like.

Understanding the Actor Element of an xAPI Statement

So, first things first – an actor can be one of two things: an Agent or a Group.

Agent Actors

Agents can be identified in 4 different ways:

  1. mbox
  2. mbox_sha1sum
  3. openid
  4. account

The mbox is basically the user’s email address. For example:

 

{

“objectType”: “Agent”,

“name”: “John Smith”,

“mbox”: “mailto:[email protected]

}

mbox_sha1sum is an encrypted version of the email address. For example:

 

{

“objectType”: “Agent”,

“name”: “John Smith”,

“mbox_sha1sum”: “4445904ac65039ef7a91506207f19162ac4dea73”

}

The openid is the URL. For example:

 

{

“objectType”: “Agent”,

“name”: “John Smith”,

“openid”: “http://www.example.com/johnsmith”

}

The account element has both a name (which is like a user identifier) and a homepage which is usually the URL of the website that the activity is taking place on. For example:

 

{

“objectType”: “Agent”,

“name”: “John Smith”,

“account”: {

“name”: “123”,

“homePage”: “http://www.example.com/users/”

}

}

Group Actors

Group actors can be either identified or anonymous.

As with agent actors, a group can also be identified by the above 4 elements – in which case it is an ‘Identified Group’. For example:

 

{

“objectType”: “Group”,

“name”: “HT2”,

“account”: {

“name”: “123”,

“homePage”: “http://www.example.com/users/”

}

“member”: []
}

Both group types can have members: if the group is not an ‘Identified Group’, it is an ‘Anonymous Group’ and must have at least 1 member. For example:

 

{

“objectType”: “Group”,

“name”: “HT2”,

“member”: [{

“objectType”: “Agent”,

“name”: “John Smith”,

“account”: {

“name”: “123”,

“homePage”: “http://www.example.com/users/”

}

}]

}

An Example Actor Statement Summary

If you’re wondering what a complete Actor statement looks like, here it is:

 

{

“actor”: {

“objectType”: “Agent”,

“name”: “John Smith”,

“account”: {

“name”: “123”,

“homePage”: “http://www.example.com/users/”

}

},

“verb”: {

“id”: “http://adlnet.gov/expapi/verbs/completed”,

“display”: {

“en-GB”: “completed”

}

},

“object”: {

“objectType”: “Activity”,

“id”: “http://www.example.com/activities/1”

}

}

So to recap, an actor can be one of two things: an Agent or a Group. You’re probably going to use an Agent for the most part. An Agent can be 4 different ways: mbox, mbox_sha1sum, openid, or an account; but we’d recommend using an account.

Next up, we’ll be taking a look at the Verb Element of an xAPI Statement.

– – –

For more practical tips and advice about the xAPI, download our Technology Managers Guide to xAPI