Skip to content
learning locker

How to Query an LRS to get xAPI Statements

So you’ve got your LRS set up, and it’s doing a great job of storing your activity data, and your dashboards are looking great. But how do you actually gain more detailed insights into the data? Well, in this post we’ll be having a quick look at ways in which you can query xAPI statements – or more specifically the Statement API.

Before you get started, you’ll need a suitable API query builder such as Postman.  You might also find it useful to watch along with this video if you’re unfamiliar with the interface.

Querying the Statement API

The statement API allows you to create statements and retrieve one or many statements that you previously created.

Creating a Statement

You can create a statement with the following request.



Authorization:Basic YOUR_BASIC_AUTH




{    “actor”:{        “objectType”:”Agent”,        “name”:”John Smith”,        “account”:{            “name”:”123″,            “homePage”:””        }    },    “verb”:{        “id”:””,        “display”:{            “en-GB”:”completed”        }    },    “object”:{        “objectType”:”Activity”,        “id”:”″    } }





Querying Known Statement IDs

Using the statement ID that the LRS provides you in response to creating a statement, you can query the statement from the API, with the following request.



Authorization:Basic YOUR_BASIC_AUTH


Multiple Statement Queries

If you want to query multiple statements, you can create the following request.



Authorization:Basic YOUR_BASIC_AUTH


Additional xAPI Queries

So there you have just 3 example queries that you can run on your xAPI data. For further details on which parts of a statement can be queried, check out the official specification documentation.

Next up, we’ll be taking a look at how to void xAPI Statements.

For more practical tips on the xAPI, check out our free Learning Technology Manager’s Guide to xAPI

Got a learning problem to solve?

Get in touch to discover how we can help

CTA background