When implementing xAPI, a helpful first step can be to send a simple xAPI statement to Watershed so that you can see how the request works. This guide explains how to send a simple xAPI statement to Watershed using Postman.
Please note: When implementing xAPI in your application, it is recommended to use a code library that will handle the API calls and some statement syntax validation.
- User Roles
- Only Global Admins can create the authorization credentials required to send xAPI data.
- Pricing
- Available on plans (Essentials, Analyst, CLO, and Enterprise).
- Expertise
- Experts familiar with JSON and APIs can use this feature.
Create API Authorization Credentials
Before you can send an xAPI statement, you will need to get an endpoint, key and secret from Watershed. This is explained in How do I add an activity provider to Watershed?
Write an xAPI statement
You will also need to write an xAPI statement. xAPI statements are records of an individual learner interaction. You can read about statement design in How to Implement xAPI.
Hint: You can also use xAPI Lab to build and send an example statement.
For this example we can use an example simple statement like this:
{ "id":"fd41c918-b88b-4b20-a0a5-a4c32391aaa0", "timestamp": "2015-11-18T12:17:00+00:00", "actor":{ "objectType": "Agent", "name":"Project Tin Can API", "mbox":"mailto:user@example.com" }, "verb":{ "id":"http://example.com/xapi/verbs#sent-a-statement", "display":{ "en-US":"sent" } }, "object":{ "id":"http://example.com/xapi/activity/simplestatement", "definition":{ "name":{ "en-US":"simple statement" }, "description":{ "en-US":"A simple Experience API statement. Note that the LRS does not need to have any prior information about the Actor (learner), the verb, or the Activity/object." } } } }
Send the Statement using Postman
To send the statement using Postman, set the method to POST and enter the Endpoint from Watershed in the Request URL, followed by "statements".
On the Authorization tab, select Basic Auth and enter the Key and Secret from Watershed as the Username and Password.
On the Headers tab, the Authorization will be automatically populated using the key and secret you provided. Add an X-Experience-API-Version header with a value of "1.0.3" and a Content-Type header with a value of "application/json".
On the Body tab, select raw and set the type to JSON (application/json). Paste in the statement to send.
Click the blue Send button to send the statement.