SlideShare a Scribd company logo
2
Most read
5
Most read
6
Most read
With JavaScript
RESTful API Automation
Jonathan LeBlanc
Head of Developer Evangelism (North America)
Github: http://github.com/jcleblanc
Slides: http://slideshare.net/jcleblanc
Twitter: @jcleblanc
What We’re Covering
REST Concepts
Automation through hypermedia
constraints
OAuth 2 in JavaScript
What We Want
JavaScript Challenges
Cross Origin Resource Sharing
Access to other domains / subdomains is
restricted (same origin policy)
JSONP to request resources across domains
Cross-origin resource sharing (CORS)
You Send: Origin: http://site.com
They Send: Access-Control-Allow-Origin: http://site.com
Keeping Things Hidden
Token based auth mechanism
OAuth: Client Secret
Basic Auth: Password
API request action to reaction mapping
A schematic for how data forces site changes
Action Automation
RESTful API Core Concepts
Honor HTTP request verbs
Use proper HTTP status codes
No version numbering in URIs
Return format via HTTP Accept header
Double Rainbow: Discovery via HATEOAS
Uniform Interface Sub-Constraints
Resource Identification
Resources must be manipulated via
representations
Self descriptive messages
Hypermedia as the engine of
application state
How we Normally Consume APIs
Using HATEOAS to Automate
"links": [
{
"href":"https://api.sandbox.paypal.com/v1/payments/
authorization/6H149011U8307001M",
"rel":"self",
"method":"GET"
},{
"href":"https://api.sandbox.paypal.com/v1/payments/
authorization/6H149011U8307001M/capture",
"rel":"capture",
"method":"POST"
},{
"href":"https://api.sandbox.paypal.com/v1/payments/
authorization/6H149011U8307001M/void",
"rel":"void",
"method":"POST"
}
]
OAuth 2 & JavaScript?
A Little Use Background
User login
Application only
User Involvement
User Agent Flow: Redirect
Prepare the Redirect URI
Authorization Endpoint
client_id response_type (token)
scope redirect_uri
Browser Redirect
Redirect URI
User Agent Flow: Redirect
Building the redirect link
var auth_uri = auth_endpoint +
"?response_type=token" +
"&client_id=" + client_id +
"&scope=profile" +
"&redirect_uri=" + window.location;
$("#auth_btn").attr("href", auth_uri);
User Agent Flow: Hash Mod
Fetch the Hash Mod
access_token
refresh_token
expires_in
Extract Access Token
User Agent Flow: Hash Mod
http://site.com/callback#access_token=rBEGu1FQr5
4AzqE3Q&refresh_token=rEBt51FZr54HayqE3V4a&
expires_in=3600
var hash = document.location.hash;
var match = hash.match(/access_token=(w+)/);
Extracting the access token from the hash
User Agent Flow: Get Resources
Set Request Headers + URI
Resource Endpoint
Header: token type + access token
Header: accept data type
HTTPS Request
User Agent Flow: Get Resources
$.ajax({
url: resource_uri,
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'OAuth ' + token);
xhr.setRequestHeader('Accept', 'application/json');
},
success: function (response) {
//use response object
}
});
Making an authorized request
Good JavaScript API Interaction
Using Proper REST standards
Automation through hypermedia
constraints
Using OAuth 2 appropriately
http://bit.ly/rest_automation_js
Thank You! Questions?
Jonathan LeBlanc
Head of Developer Evangelism (North America)
Github: http://github.com/jcleblanc
Slides: http://slideshare.net/jcleblanc
Twitter: @jcleblanc

More Related Content

What's hot (19)

PDF
REST API and CRUD
Prem Sanil
 
PPTX
Test in Rest. API testing with the help of Rest Assured.
Artem Korchevyi
 
PPTX
Test Design and Automation for REST API
Ivan Katunou
 
PDF
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
PPTX
B4USolution_API-Testing
b4usolution .
 
PPSX
Rest api standards and best practices
Ankita Mahajan
 
PDF
Best Practices in Web Service Design
Lorna Mitchell
 
PDF
Testing REST Web Services
Jan Algermissen
 
PDF
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
 
PPTX
Knowledge of web ui for automation testing
Artem Korchevyi
 
PPTX
Frisby Api automation
Dineesha Suraweera
 
PPTX
RESTful modules in zf2
Corley S.r.l.
 
PDF
API Testing. Streamline your testing process.
Andrey Oleynik
 
PDF
Pentesting RESTful webservices
Mohammed A. Imran
 
PPTX
REST-API introduction for developers
Patrick Savalle
 
PDF
Reasons To Automate API Testing Process
QASource
 
PDF
Securty Testing For RESTful Applications
Source Conference
 
PDF
Restful api design
Mizan Riqzia
 
PPTX
RESTful API Design Best Practices Using ASP.NET Web API
💻 Spencer Schneidenbach
 
REST API and CRUD
Prem Sanil
 
Test in Rest. API testing with the help of Rest Assured.
Artem Korchevyi
 
Test Design and Automation for REST API
Ivan Katunou
 
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
B4USolution_API-Testing
b4usolution .
 
Rest api standards and best practices
Ankita Mahajan
 
Best Practices in Web Service Design
Lorna Mitchell
 
Testing REST Web Services
Jan Algermissen
 
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
 
Knowledge of web ui for automation testing
Artem Korchevyi
 
Frisby Api automation
Dineesha Suraweera
 
RESTful modules in zf2
Corley S.r.l.
 
API Testing. Streamline your testing process.
Andrey Oleynik
 
Pentesting RESTful webservices
Mohammed A. Imran
 
REST-API introduction for developers
Patrick Savalle
 
Reasons To Automate API Testing Process
QASource
 
Securty Testing For RESTful Applications
Source Conference
 
Restful api design
Mizan Riqzia
 
RESTful API Design Best Practices Using ASP.NET Web API
💻 Spencer Schneidenbach
 

Viewers also liked (20)

PPTX
Frisby: Rest API Automation Framework
Quovantis
 
PDF
Web API Test Automation using Frisby & Node.js
Chi Lang Le Vu Tran
 
PPTX
Test Automation
Tomas Riha
 
PDF
API TEST
copremesis
 
PPTX
REST API testing with SpecFlow
Aiste Stikliute
 
PDF
API TEST
copremesis
 
PPTX
SeaJUG May 2012 mybatis
Will Iverson
 
PPTX
Syntribos API Security Test Automation
Matthew Valdes
 
PDF
Automation testing API in Java
Wix.com
 
PPTX
How to Choose an API Automation Tool for a Distributed Cloud-based App: To...
Altoros
 
PPTX
Design Summit - RESTful API Overview - John Hardy
ManageIQ
 
PDF
OpenERP 6.1 Framework Changes
Odoo
 
PPT
Automation framework
ITeLearn
 
PDF
WSO2 Test Automation Framework : Approach and Adoption
WSO2
 
PDF
Crash Introduction to Modern Java Data Access: Understanding JPA, Hibernate, ...
Vladimir Bacvanski, PhD
 
PPTX
Automated API pentesting using fuzzapi
Abhijeth D
 
PDF
Светлана Исакова «Язык Kotlin»
e-Legion
 
PDF
MyBatis 개요와 Java+MyBatis+MySQL 예제
정완 전
 
PPTX
SpringBoot with MyBatis, Flyway, QueryDSL
Sunghyouk Bae
 
PPTX
MyBatis
Roman Dovgan
 
Frisby: Rest API Automation Framework
Quovantis
 
Web API Test Automation using Frisby & Node.js
Chi Lang Le Vu Tran
 
Test Automation
Tomas Riha
 
API TEST
copremesis
 
REST API testing with SpecFlow
Aiste Stikliute
 
API TEST
copremesis
 
SeaJUG May 2012 mybatis
Will Iverson
 
Syntribos API Security Test Automation
Matthew Valdes
 
Automation testing API in Java
Wix.com
 
How to Choose an API Automation Tool for a Distributed Cloud-based App: To...
Altoros
 
Design Summit - RESTful API Overview - John Hardy
ManageIQ
 
OpenERP 6.1 Framework Changes
Odoo
 
Automation framework
ITeLearn
 
WSO2 Test Automation Framework : Approach and Adoption
WSO2
 
Crash Introduction to Modern Java Data Access: Understanding JPA, Hibernate, ...
Vladimir Bacvanski, PhD
 
Automated API pentesting using fuzzapi
Abhijeth D
 
Светлана Исакова «Язык Kotlin»
e-Legion
 
MyBatis 개요와 Java+MyBatis+MySQL 예제
정완 전
 
SpringBoot with MyBatis, Flyway, QueryDSL
Sunghyouk Bae
 
MyBatis
Roman Dovgan
 
Ad

Similar to RESTful API Automation with JavaScript (20)

PPTX
Securing RESTful APIs using OAuth 2 and OpenID Connect
Jonathan LeBlanc
 
PPTX
Designing JavaScript APIs
Jonathan LeBlanc
 
PPTX
Securing RESTful Payment APIs Using OAuth 2
Jonathan LeBlanc
 
PPTX
API design principles for accelerated development
Jonathan LeBlanc
 
PDF
Spring security oauth2
axykim00
 
PDF
oauth-for-credentials-security-in-rest-api-access
idsecconf
 
PPTX
Restful api
Anurag Srivastava
 
PDF
Stateless Auth using OAUTH2 & JWT
Mobiliya
 
PPTX
Devteach 2017 OAuth and Open id connect demystified
Taswar Bhatti
 
PPTX
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
PPT
Securing RESTful API
Muhammad Zbeedat
 
PPTX
(1) OAuth 2.0 Overview
anikristo
 
PDF
Spring4 security oauth2
Sang Shin
 
PPTX
An introduction to OAuth 2
Sanjoy Kumar Roy
 
PPTX
Introduction to OAuth2
Kumaresh Chandra Baruri
 
PDF
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
PPTX
OAuth2 Implementation Presentation (Java)
Knoldus Inc.
 
PDF
Spring4 security oauth2
axykim00
 
PPTX
Single-Page-Application & REST security
Igor Bossenko
 
PPTX
Securing APIs using OAuth 2.0
Adam Lewis
 
Securing RESTful APIs using OAuth 2 and OpenID Connect
Jonathan LeBlanc
 
Designing JavaScript APIs
Jonathan LeBlanc
 
Securing RESTful Payment APIs Using OAuth 2
Jonathan LeBlanc
 
API design principles for accelerated development
Jonathan LeBlanc
 
Spring security oauth2
axykim00
 
oauth-for-credentials-security-in-rest-api-access
idsecconf
 
Restful api
Anurag Srivastava
 
Stateless Auth using OAUTH2 & JWT
Mobiliya
 
Devteach 2017 OAuth and Open id connect demystified
Taswar Bhatti
 
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
Securing RESTful API
Muhammad Zbeedat
 
(1) OAuth 2.0 Overview
anikristo
 
Spring4 security oauth2
Sang Shin
 
An introduction to OAuth 2
Sanjoy Kumar Roy
 
Introduction to OAuth2
Kumaresh Chandra Baruri
 
JavaOne 2014 - Securing RESTful Resources with OAuth2
Rodrigo Cândido da Silva
 
OAuth2 Implementation Presentation (Java)
Knoldus Inc.
 
Spring4 security oauth2
axykim00
 
Single-Page-Application & REST security
Igor Bossenko
 
Securing APIs using OAuth 2.0
Adam Lewis
 
Ad

More from Jonathan LeBlanc (20)

PDF
JavaScript App Security: Auth and Identity on the Client
Jonathan LeBlanc
 
PDF
Improving Developer Onboarding Through Intelligent Data Insights
Jonathan LeBlanc
 
PDF
Better Data with Machine Learning and Serverless
Jonathan LeBlanc
 
PPTX
Best Practices for Application Development with Box
Jonathan LeBlanc
 
PPTX
Box Platform Overview
Jonathan LeBlanc
 
PPTX
Box Platform Developer Workshop
Jonathan LeBlanc
 
PPTX
Modern Cloud Data Security Practices
Jonathan LeBlanc
 
PPTX
Box Authentication Types
Jonathan LeBlanc
 
PPTX
Understanding Box UI Elements
Jonathan LeBlanc
 
PPTX
Understanding Box applications, tokens, and scoping
Jonathan LeBlanc
 
PPTX
The Future of Online Money: Creating Secure Payments Globally
Jonathan LeBlanc
 
PDF
Modern API Security with JSON Web Tokens
Jonathan LeBlanc
 
PPTX
Creating an In-Aisle Purchasing System from Scratch
Jonathan LeBlanc
 
PDF
Secure Payments Over Mixed Communication Media
Jonathan LeBlanc
 
PDF
Protecting the Future of Mobile Payments
Jonathan LeBlanc
 
PDF
Node.js Authentication and Data Security
Jonathan LeBlanc
 
PDF
PHP Identity and Data Security
Jonathan LeBlanc
 
PPTX
Secure Payments Over Mixed Communication Media
Jonathan LeBlanc
 
PDF
Protecting the Future of Mobile Payments
Jonathan LeBlanc
 
PPTX
Future of Identity, Data, and Wearable Security
Jonathan LeBlanc
 
JavaScript App Security: Auth and Identity on the Client
Jonathan LeBlanc
 
Improving Developer Onboarding Through Intelligent Data Insights
Jonathan LeBlanc
 
Better Data with Machine Learning and Serverless
Jonathan LeBlanc
 
Best Practices for Application Development with Box
Jonathan LeBlanc
 
Box Platform Overview
Jonathan LeBlanc
 
Box Platform Developer Workshop
Jonathan LeBlanc
 
Modern Cloud Data Security Practices
Jonathan LeBlanc
 
Box Authentication Types
Jonathan LeBlanc
 
Understanding Box UI Elements
Jonathan LeBlanc
 
Understanding Box applications, tokens, and scoping
Jonathan LeBlanc
 
The Future of Online Money: Creating Secure Payments Globally
Jonathan LeBlanc
 
Modern API Security with JSON Web Tokens
Jonathan LeBlanc
 
Creating an In-Aisle Purchasing System from Scratch
Jonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Jonathan LeBlanc
 
Protecting the Future of Mobile Payments
Jonathan LeBlanc
 
Node.js Authentication and Data Security
Jonathan LeBlanc
 
PHP Identity and Data Security
Jonathan LeBlanc
 
Secure Payments Over Mixed Communication Media
Jonathan LeBlanc
 
Protecting the Future of Mobile Payments
Jonathan LeBlanc
 
Future of Identity, Data, and Wearable Security
Jonathan LeBlanc
 

Recently uploaded (20)

PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
PDF
The Growing Value and Application of FME & GenAI
Safe Software
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Practical Applications of AI in Local Government
OnBoard
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
ArcGIS Utility Network Migration - The Hunter Water Story
Safe Software
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
 
The Growing Value and Application of FME & GenAI
Safe Software
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 

RESTful API Automation with JavaScript