API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.

Slides:



Advertisements
Similar presentations
Give it a REST already Arnon Rotem-Gal-Oz VP R&D xsights
Advertisements

REST Vs. SOAP.
REST Introduction 吴海生 博克软件(杭州)有限公司.
Introduction to Web Services
Overview of Twitter API Nathan Liu. Twitter API Essentials Twitter API is a Representational State Transfer(REST) style web services exposed over HTTP(S).
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
Building RESTful Interfaces
DT228/3 Web Development WWW and Client server model.
Introduction to push technology © 2009 Research In Motion Limited.
Hypertext Transfer Protocol Information Systems 337 Prof. Harry Plantinga.
Jon Flanders INT303. About Me  Jon Flanders –  Independent consultant/trainer  BizTalk MVP.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
UNDERSTANDING WEB AND WEB PROJECT PLANNING AND DESIGNING AND EFFECTIVE WEBSITE Garni Dadaian.
RESTful Web Development With Nodejs and Express. REST Stands for REpresentational State Transfer Has the following constraints: ◦Client-Server ◦Stateless.
Web server and web browser It’s a take and give policy in between client and server through HTTP(Hyper Text Transport Protocol) Server takes a request.
Beyond the UI Using Tools to Improve Testing Jeremy Traylor
Introduction to InfoSec – Recitation 7 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
FTP (File Transfer Protocol) & Telnet
Chapter 4: Core Web Technologies
Designing and Implementing Web Data Services in Perl
Web Architecture & Services (2) Representational State Transfer (REST)
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Wyatt Pearsall November  HyperText Transfer Protocol.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
Web Services An introduction for eWiSACWIS May 2008.
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin.
Python and REST Kevin Hibma. What is REST? Why REST? REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a.
Or, Hey can’t we just do it using HTTP for the envelope?
1 Welcome to CSC 301 Web Programming Charles Frank.
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
DM_PPT_NP_v01 SESIP_0715_JR HDF Server HDF for the Web John Readey The HDF Group Champaign Illinois USA.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
Appendix E: Overview of HTTP ©SoftMoore ConsultingSlide 1.
Advanced Web Technologies By: Faraz Ahmed. Contents 0 Course Outline 0 Architectures 0 HTTP.
Advanced Web Technologies Lecture #4 By: Faraz Ahmed.
Representational State Transfer (REST). What is REST? Network Architectural style Overview: –Resources are defined and addressed –Transmits domain-specific.
Web Technologies Lecture 1 The Internet and HTTP.
ICM – API Server & Forms Gary Ratcliffe.
CS 6401 The World Wide Web Outline Background Structure Protocols.
RESTful Web Services What is RESTful?
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
1/30/20161 Introduction to Web Services Bina Ramamurthy
Feeling RESTful? Well, first we’ll define a Web Service –A web page meant to be consumed by a computer via an autonomous program as opposed to a web browser.
Orion Contextbroker PROF. DR. SERGIO TAKEO KOFUJI PROF. MS. FÁBIO H. CABRINI PSI – 5120 – TÓPICOS EM COMPUTAÇÃO EM NUVEM
Representational State Transfer COMP6017 Topics on Web Services Dr Nicholas Gibbins –
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
National College of Science & Information Technology.
The Client-Server Model
API (Application Program Interface)
Better RESTFul API – Best Practices
Web Development Web Servers.
WEB SERVICES.
Data Virtualization Tutorial… CORS and CIS
Node.js Express Web Services
Advanced Web-based Systems | Misbhauddin
Lesson 11: Web Services & API's
Representational State Transfer
Ashish Pandit IT Architect, Middleware & Integration Services
WEB API.
Lecture 1: Multi-tier Architecture Overview
$, $$, $$$ API testing Edition
REST APIs Maxwell Furman Department of MIS Fox School of Business
RESTful Web Services.
Week 05 Node.js Week 05
Web-Services and RESTful APIs
WCF Data Services and Silverlight
Chengyu Sun California State University, Los Angeles
Restful APIs 101 Laura
Presentation transcript:

API Crash Course CWU Startup Club

OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an API? How do we create an API? API’s are available from many large websites and businesses

WHAT IS AN API? API = Application Programming Interface You use API’s all the time. Scanner class Java Web API: A set of methods exposed over the web via HTTP to allow programmatic access to applications. Allows you to quickly add functionality/data that others have created. Very similar to how a web page works

WHY API’S ARE USEFUL Abstraction / DRY Principle Less data transfer Can be implemented or consumed in almost any language Can expose some methods to public developers Allows frontend developers and backend developers to agree on a common interface

HTTP, JSON, XML Three important technologies that are often used by API’s HTTP: Hyper text transfer protocol, transfers data over a network GET : Read POST : Create PUT : Update PATCH : Partial Update DELETE : Delete JSON: JavaScript Object Notation, a format for data transfer {“key”: “value”, “key2”:{“subkey”: 2, “error”: false}} XML: EXtensible Markup Language: a format for data transfer Designed to be human and machine readable

WHAT IS A RESTFUL API? Uniform Interface Resources (Nouns) URI’s that HTTP Verbs act on. The uniform interface allows Client / Server to evolve independently. Stateless Ever have back button issues? Stateless does not care what order requests are made in. Cacheable Client-Server Separation, client should not manage database, server should not manage UI. Layered System Can uses layered system, cache, middle ware, load balancing, redundancy etc. GitHub's API lets you star a gist with PUT /gists/:id/star and unstar with DELETE /gists/:id/star.

HOW TO CONSUME AN API Firefox: RESTClient Chrome: Postman Online: Examples: POST (Feedback, message) or GET

HOW DO DESIGN AN API Gather requirements from stakeholders Create use cases, and decide the functionality needed Think skeptically, make sure you explore your options Think ahead, make a flexible system Easy To learn and use, even without documentation Hard to misuse Easy to read and maintain code that uses it Sufficiently powerful to satisfy requirements and Appropriate to audience Easy to evolve (Use arrays for example) Rules for a good API

CREATING A SIMPLE API You can use any hostable language with a HTTP library (Almost all of them) Decide your resources, then decide the verbs. Useful to wireframe the UI at this stage Connect to persistent data store Remember the principles of REST Example in Node.JS:

ADVANCED TOPICS Use API Keys pass as a parameter Rate Limiting Headers X-Rate-Limit-Limit - The number of allowed requests in the current period X-Rate-Limit-Remaining - The number of remaining requests in the current period X-Rate-Limit-Reset - The number of seconds left in the current period Authentication A REST API should be stateless, send auth with every request Use ssl, send auth username and base64 password over authentication header Caching HTTP Provides this! Last-Modified header Etag header, hash or checksum, If-None-Match: “etag” Errors { "code" : 1234, "message" : "Something bad happened :(", "description" : "More details about the error here" } Send HTTP Status 400 level 401 unauthorized 403 forbidden 404 not found 405 method not allowed 410 gone (depreciated) 422 Unprocessable entity (validation) 429 Too many requests (Rate limit)