SlideShare a Scribd company logo
1 of 15
xAPI: Four Lines of Code!
Buckle up, folks…
We’re looking at
CODE!
Tracking Events
• What are the events you want to track?
– Video: Play, Pause, Complete
– Security System: ID Card Scan
– Beacons: Beacon found, Beacon Lost
• What data does each event make available?
• How do you detect each event?
• How will the event fire off the statement?
This Pretty, Formatted statement…
{ "actor": {
"mbox": "mailto:Tom@example.com",
"name": "Tom Tompson",
"objectType": "Agent” },
"verb": {
"id": "http://adlnet.gov/expapi/verbs/answered",
"display": {"en-US": "answered” }
},
"object": {
"id": "http://adlnet.gov/expapi/activities/example",
"definition": {"name": {"en-US": "Example Activity” },
"description": {"en-US": "Example activity description”}},
"objectType": "Activity”}
}
…is the same as:
{"actor":{"mbox":"mailto:Tom@example.com",
"name": "Tom
Tompson","objectType":"Agent”},"verb":{"id":"http:
//adlnet.gov/expapi/verbs/answered","display":{"e
n-
US":"answered”}},"object":{"id":"http://adlnet.gov/
expapi/activities/example","definition":{"name":{"e
n-US":"ExampleActivity”},"description":{"en-
US":"Exampleactivitydescription”}},"objectType":"A
ctivity"}}
Four lines of Code
1. Define the learning record store (LRS) and
authoritative credentials to a variable
2. Tell the browser to use that LRS/variable
3. Define the xAPI statement
4. Send the statement
5. Profit! (Optional)
Four lines of Code
1. Define the learning record store (LRS) and
the username and password to authenticate
var conf = {
"endpoint" : "https://lrs.adlnet.gov/xapi/",
"auth" : "Basic " + toBase64("xapi-tools:xapi-tools")
};
Four lines of Code
2. Tell the browser to use that LRS
ADL.XAPIWrapper.changeConfig(conf);
Four lines of Code
3. Define the xAPI statement
statement = {"actor": {
"mbox": "mailto:Tom@example.com",
"name": "Tom Tompson",
"objectType": "Agent”
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/attended",
"display": {"en-US": ”attended"}
},
"object": {
"id": "https://DevLearn2018.com",
"objectType": "Activity",
"definition": {
"name": {"en-US": ”DevLearn 2018"},
"description": {"en-US": ”DevLearn 2018 – the premier eLearning conference!"}
}}}};
Four lines of Code
4. Send the statement
var result = ADL.XAPIWrapper.sendStatement(statement);
Four lines of Code
5. Profit!*
*Optional
Tracking Video Events with HTML5
• HTML5 has a great set of APIs:
– Play – onPlay
– Pause –onPause
– Ended– Say it with me now… onEnded!
• When the user creates the event, the matching
API is fired, and you can send your statement!
• What data do you want to know about the user’s
interactions?
Building a Statement from an I.o.T. Security Device
https://www.learningsolutionsmag.com/aut
hors/625/anthony-altieri
My series of articles on
xAPI
Example Code
• NFC Card Reader
– https://github.com/aa-altieri/MiFare-xAPI
• Correlating Video
– https://github.com/aa-
altieri/correlating_xapi_events
• Tracking iBeacon
– https://github.com/aa-altieri/LRS_Beacon
Anthony Altieri - IDIoT in Chief
Omnes Solutions LLC
altierian@gmail.com
@aa_altieri

More Related Content

Similar to xAPI Camp-Four Lines of Code

The Hidden XSS - Attacking the Desktop & Mobile Platforms
The Hidden XSS - Attacking the Desktop & Mobile PlatformsThe Hidden XSS - Attacking the Desktop & Mobile Platforms
The Hidden XSS - Attacking the Desktop & Mobile Platformskosborn
 
User Expectations in Mobile App Security
User Expectations in Mobile App SecurityUser Expectations in Mobile App Security
User Expectations in Mobile App SecurityTao Xie
 
Native Phone Development 101
Native Phone Development 101Native Phone Development 101
Native Phone Development 101Sasmito Adibowo
 
Winning with Structured Data and Schema.org - OMLIVE 2018
Winning with Structured Data and Schema.org - OMLIVE 2018Winning with Structured Data and Schema.org - OMLIVE 2018
Winning with Structured Data and Schema.org - OMLIVE 2018Izzi Smith
 
My Journey into the Terrifying World of Hypermedia
My Journey into the Terrifying World of HypermediaMy Journey into the Terrifying World of Hypermedia
My Journey into the Terrifying World of HypermediaNordic APIs
 
Computational Social Science, Lecture 09: Data Wrangling
Computational Social Science, Lecture 09: Data WranglingComputational Social Science, Lecture 09: Data Wrangling
Computational Social Science, Lecture 09: Data Wranglingjakehofman
 
[2019 south bay meetup] Building more contextual message with Block Kit
[2019 south bay meetup] Building more contextual message with Block Kit[2019 south bay meetup] Building more contextual message with Block Kit
[2019 south bay meetup] Building more contextual message with Block KitTomomi Imura
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...SparkPost
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkRed Hat Developers
 
Working with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONWorking with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONSV.CO
 
Building Advanced Serverless Applications
Building Advanced Serverless ApplicationsBuilding Advanced Serverless Applications
Building Advanced Serverless ApplicationsAmazon Web Services
 
Locking the Doors -7 Pernicious Pitfalls to avoid with Java
Locking the Doors -7 Pernicious Pitfalls to avoid with JavaLocking the Doors -7 Pernicious Pitfalls to avoid with Java
Locking the Doors -7 Pernicious Pitfalls to avoid with JavaSteve Poole
 
Hdc09 I Phone Dev Connecting To Web
Hdc09   I Phone Dev Connecting To WebHdc09   I Phone Dev Connecting To Web
Hdc09 I Phone Dev Connecting To WebAndy Peters
 
Pragmatic API Design: Using D&D
Pragmatic API Design: Using D&DPragmatic API Design: Using D&D
Pragmatic API Design: Using D&DJérémy Buisson
 
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...FIWARE
 
An Introduction to Working With the Activity Stream
An Introduction to Working With the Activity StreamAn Introduction to Working With the Activity Stream
An Introduction to Working With the Activity StreamMikkel Flindt Heisterberg
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupMario Heiderich
 
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...Jakub "Kuba" Sendor
 
KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!2600Hz
 
JLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingJLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingChase Tingley
 

Similar to xAPI Camp-Four Lines of Code (20)

The Hidden XSS - Attacking the Desktop & Mobile Platforms
The Hidden XSS - Attacking the Desktop & Mobile PlatformsThe Hidden XSS - Attacking the Desktop & Mobile Platforms
The Hidden XSS - Attacking the Desktop & Mobile Platforms
 
User Expectations in Mobile App Security
User Expectations in Mobile App SecurityUser Expectations in Mobile App Security
User Expectations in Mobile App Security
 
Native Phone Development 101
Native Phone Development 101Native Phone Development 101
Native Phone Development 101
 
Winning with Structured Data and Schema.org - OMLIVE 2018
Winning with Structured Data and Schema.org - OMLIVE 2018Winning with Structured Data and Schema.org - OMLIVE 2018
Winning with Structured Data and Schema.org - OMLIVE 2018
 
My Journey into the Terrifying World of Hypermedia
My Journey into the Terrifying World of HypermediaMy Journey into the Terrifying World of Hypermedia
My Journey into the Terrifying World of Hypermedia
 
Computational Social Science, Lecture 09: Data Wrangling
Computational Social Science, Lecture 09: Data WranglingComputational Social Science, Lecture 09: Data Wrangling
Computational Social Science, Lecture 09: Data Wrangling
 
[2019 south bay meetup] Building more contextual message with Block Kit
[2019 south bay meetup] Building more contextual message with Block Kit[2019 south bay meetup] Building more contextual message with Block Kit
[2019 south bay meetup] Building more contextual message with Block Kit
 
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...Insight User Conference Bootcamp - Use the Engagement Tracking  and Metrics A...
Insight User Conference Bootcamp - Use the Engagement Tracking and Metrics A...
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
 
Working with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSONWorking with the Web: 
Decoding JSON
Working with the Web: 
Decoding JSON
 
Building Advanced Serverless Applications
Building Advanced Serverless ApplicationsBuilding Advanced Serverless Applications
Building Advanced Serverless Applications
 
Locking the Doors -7 Pernicious Pitfalls to avoid with Java
Locking the Doors -7 Pernicious Pitfalls to avoid with JavaLocking the Doors -7 Pernicious Pitfalls to avoid with Java
Locking the Doors -7 Pernicious Pitfalls to avoid with Java
 
Hdc09 I Phone Dev Connecting To Web
Hdc09   I Phone Dev Connecting To WebHdc09   I Phone Dev Connecting To Web
Hdc09 I Phone Dev Connecting To Web
 
Pragmatic API Design: Using D&D
Pragmatic API Design: Using D&DPragmatic API Design: Using D&D
Pragmatic API Design: Using D&D
 
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
Session 7 - Connecting to Legacy Systems, IoT and other Systems | Train the T...
 
An Introduction to Working With the Activity Stream
An Introduction to Working With the Activity StreamAn Introduction to Working With the Activity Stream
An Introduction to Working With the Activity Stream
 
I thought you were my friend - Malicious Markup
I thought you were my friend - Malicious MarkupI thought you were my friend - Malicious Markup
I thought you were my friend - Malicious Markup
 
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...
Slicing Apples with Ninja Sword: Fighting Malware at the Corporate Level (OWA...
 
KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!KazooCon 2014 - Introduction to Kazoo APIs!
KazooCon 2014 - Introduction to Kazoo APIs!
 
JLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're goingJLIFF: Where we are, and where we're going
JLIFF: Where we are, and where we're going
 

Recently uploaded

ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Cantervoginip
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...Amil Baba Dawood bangali
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一F sss
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理e4aez8ss
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 

Recently uploaded (20)

Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
ASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel CanterASML's Taxonomy Adventure by Daniel Canter
ASML's Taxonomy Adventure by Daniel Canter
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
办理学位证中佛罗里达大学毕业证,UCF成绩单原版一比一
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 

xAPI Camp-Four Lines of Code

  • 1. xAPI: Four Lines of Code! Buckle up, folks… We’re looking at CODE!
  • 2. Tracking Events • What are the events you want to track? – Video: Play, Pause, Complete – Security System: ID Card Scan – Beacons: Beacon found, Beacon Lost • What data does each event make available? • How do you detect each event? • How will the event fire off the statement?
  • 3. This Pretty, Formatted statement… { "actor": { "mbox": "mailto:Tom@example.com", "name": "Tom Tompson", "objectType": "Agent” }, "verb": { "id": "http://adlnet.gov/expapi/verbs/answered", "display": {"en-US": "answered” } }, "object": { "id": "http://adlnet.gov/expapi/activities/example", "definition": {"name": {"en-US": "Example Activity” }, "description": {"en-US": "Example activity description”}}, "objectType": "Activity”} }
  • 4. …is the same as: {"actor":{"mbox":"mailto:Tom@example.com", "name": "Tom Tompson","objectType":"Agent”},"verb":{"id":"http: //adlnet.gov/expapi/verbs/answered","display":{"e n- US":"answered”}},"object":{"id":"http://adlnet.gov/ expapi/activities/example","definition":{"name":{"e n-US":"ExampleActivity”},"description":{"en- US":"Exampleactivitydescription”}},"objectType":"A ctivity"}}
  • 5. Four lines of Code 1. Define the learning record store (LRS) and authoritative credentials to a variable 2. Tell the browser to use that LRS/variable 3. Define the xAPI statement 4. Send the statement 5. Profit! (Optional)
  • 6. Four lines of Code 1. Define the learning record store (LRS) and the username and password to authenticate var conf = { "endpoint" : "https://lrs.adlnet.gov/xapi/", "auth" : "Basic " + toBase64("xapi-tools:xapi-tools") };
  • 7. Four lines of Code 2. Tell the browser to use that LRS ADL.XAPIWrapper.changeConfig(conf);
  • 8. Four lines of Code 3. Define the xAPI statement statement = {"actor": { "mbox": "mailto:Tom@example.com", "name": "Tom Tompson", "objectType": "Agent” }, "verb": { "id": "http://adlnet.gov/expapi/verbs/attended", "display": {"en-US": ”attended"} }, "object": { "id": "https://DevLearn2018.com", "objectType": "Activity", "definition": { "name": {"en-US": ”DevLearn 2018"}, "description": {"en-US": ”DevLearn 2018 – the premier eLearning conference!"} }}}};
  • 9. Four lines of Code 4. Send the statement var result = ADL.XAPIWrapper.sendStatement(statement);
  • 10. Four lines of Code 5. Profit!* *Optional
  • 11. Tracking Video Events with HTML5 • HTML5 has a great set of APIs: – Play – onPlay – Pause –onPause – Ended– Say it with me now… onEnded! • When the user creates the event, the matching API is fired, and you can send your statement! • What data do you want to know about the user’s interactions?
  • 12. Building a Statement from an I.o.T. Security Device
  • 14. Example Code • NFC Card Reader – https://github.com/aa-altieri/MiFare-xAPI • Correlating Video – https://github.com/aa- altieri/correlating_xapi_events • Tracking iBeacon – https://github.com/aa-altieri/LRS_Beacon
  • 15. Anthony Altieri - IDIoT in Chief Omnes Solutions LLC altierian@gmail.com @aa_altieri