xAPI Statement 101: Actor Element

20 June 2016 by Ryan Smith

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:johnsmith@example.com”

}

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”: “https://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”: “https://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”: “https://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”: “https://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”: “https://www.example.com/users/”

}

},

“verb”: {

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

“display”: {

“en-GB”: “completed”

}

},

“object”: {

“objectType”: “Activity”,

“id”: “https://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

blank
Ryan Smith
Software Development Team Lead

Starting as a placement student in 2014, Ryan re-joined the Learning Locker team after graduating from Oxford Brookes University where he won the John Birch prize for the highest grade average in the University.

From his minimalist desk, Ryan leads the Learning Locker team and consults with people on all things xAPI to conscientiously craft products and services that sustain and evolve training and performance.

When he’s not swimming or injuring himself on the cricket field, Ryan enjoys playing funny (and usually inappropriate) games with his family.

View more from Ryan Smith
blank
Read more about Learning Pool
Visit our Learn and Connect section

Get a free demo

Get in touch to find out how we can help

Start your learning journey

Get started by telling us what you need and one of our team will be in touch very soon.