REST API Development. B. Mason Netapp E-Series



Similar documents
02267: Software Development of Web Services

02267: Software Development of Web Services

Distribution and Integration Technologies

REST web services. Representational State Transfer Author: Nemanja Kojic

Design REST Services with CXF JAX- RS implementation: best practices and lessons learned

Cross-domain Identity Management System for Cloud Environment

Mobility Information Series

Security Testing For RESTful Applications

Leveraging Cloud Storage Through Mobile Applications Using Mezeo Cloud Storage Platform REST API. John Eastman Mezeo

REST services in Domino - Domino Access Services

REST vs. SOAP: Making the Right Architectural Decision

Modern Web Development From Angle Brackets to Web Sockets

Designing RESTful Web Applications

ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

WEB SERVICES. Revised 9/29/2015

Developing Java Web Services

StreamServe Persuasion SP4 Service Broker

XML Processing and Web Services. Chapter 17

Outline Definition of Webserver HTTP Static is no fun Software SSL. Webserver. in a nutshell. Sebastian Hollizeck. June, the 4 th 2013

Chapter 27 Hypertext Transfer Protocol

The end. Carl Nettelblad

Session 6 Patterns and best practices in SOA/REST

vcommander will use SSL and session-based authentication to secure REST web services.

Web. Services. Web Technologies. Today. Web. Technologies. Internet WWW. Protocols TCP/IP HTTP. Apache. Next Time. Lecture # Apache.

Domain Name System (DNS)

Progress OpenEdge REST

MarkLogic Server. Java Application Developer s Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

7 Why Use Perl for CGI?

Customize Mobile Apps with MicroStrategy SDK: Custom Security, Plugins, and Extensions

HTTP. Internet Engineering. Fall Bahador Bakhshi CE & IT Department, Amirkabir University of Technology

Introduction to the. Barracuda Embedded Web-Server

An Oracle White Paper June RESTful Web Services for the Oracle Database Cloud - Multitenant Edition

Apache. Version 1.0. Developer Guide

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

Fairsail REST API: Guide for Developers

Computer Networks. Lecture 7: Application layer: FTP and HTTP. Marcin Bieńkowski. Institute of Computer Science University of Wrocław

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

About This Document 3. Integration and Automation Capabilities 4. Command-Line Interface (CLI) 8. API RPC Protocol 9.

WEB SERVICES TEST AUTOMATION

Lesson 4 Web Service Interface Definition (Part I)

IBM Cloud Manager with OpenStack. REST API Reference, version 4.1

Cloud Elements! Marketing Hub Provisioning and Usage Guide!

ReSTful OSGi Web Applications Tutorial. Khawaja Shams & Jeff Norris

What is Distributed Annotation System?

Web Services ( )

Internet Technologies. World Wide Web (WWW) Proxy Server Network Address Translator (NAT)

Java EE Introduction, Content. Component Architecture: Why and How Java EE: Enterprise Java

Integrating Complementary Tools with PopMedNet TM

Remote Access API 2.0

JVA-561. Developing SOAP Web Services in Java

Some REST Design Patterns (and Anti-Patterns)

Selenium WebDriver. Gianluca Carbone. Selenium WebDriver 1

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Web Architecture I u

Middleware Lou Somers

ICE Trade Vault. Public User & Technology Guide June 6, 2014

WIRIS quizzes web services Getting started with PHP and Java

Building Web-based Infrastructures for Smart Meters

Oracle Application Server 10g Web Services Frequently Asked Questions Oct, 2006

Hypertext for Hyper Techs

X.500 and LDAP Page 1 of 8

Cloud to Cloud Integrations with Force.com. Sandeep Bhanot Developer

ACM Crossroads Student Magazine The ACM's First Electronic Publication

Introduction to Oracle WebLogic. Presented by: Fatna Belqasmi, PhD, Researcher at Ericsson

B6: GET /started/with/ HTTP Analysis

Oracle Communications WebRTC Session Controller: Basic Admin. Student Guide

Title page. Alcatel-Lucent 5620 SERVICE AWARE MANAGER 13.0 R7

Mobile Application Development Connecting with PHP REST Servers from Android

Middleware and the Internet. Example: Shopping Service. What could be possible? Service Oriented Architecture

Secure Coding SSL, SOAP and REST. Astha Singhal Product Security Engineer salesforce.com

The presentation explains how to create and access the web services using the user interface. WebServices.ppt. Page 1 of 14

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

GATE Mímir and cloud services. Multi-paradigm indexing and search tool Pay-as-you-go large-scale annotation

Bayeux Protocol: la nuova frontiera della comunicazione a portata di mano. Relatore Nino Guarnacci

Perceptive Integration Server

Visualizing an OrientDB Graph Database with KeyLines

Safeguard Ecommerce Integration / API

Performance Testing Web 2.0

CTIS 256 Web Technologies II. Week # 1 Serkan GENÇ

... Introduction... 17

Web Programming. Robert M. Dondero, Ph.D. Princeton University

Efficiency of Web Based SAX XML Distributed Processing

Integration of Hotel Property Management Systems (HPMS) with Global Internet Reservation Systems

11.1 Web Server Operation

Project SailFin: Building and Hosting Your Own Communication Server.

MathCloud: From Software Toolkit to Cloud Platform for Building Computing Services

SIP Protocol as a Communication Bus to Control Embedded Devices

Web Container Components Servlet JSP Tag Libraries

The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into

TWO-WAY & SMS MESSAGING SMS WEB SERVICE. Product White Paper. Website: Telephone: enquiries@m-science.

Bitcoin Payment Gateway API

Web Services Tutorial

Apache Web Server System Description

API documentation - 1 -

Why API? Using the REST API in an education environment. JAMF Software, LLC

Transcription:

+ REST API Development B. Mason Netapp E-Series

+ Disclaimer Opinion expressed here are mine and do not necessarily represent Netapp 2

Who am I?? Software Engineer at Netapp E-Series AppAware Designer and lead for the REST API for E-Series Have done various API in C/C++/Java/SOAP/REST I am not selling a book or anything 3

Agenda What is a REST API? How are they different from previous API protocols? Why are they so useful? Technology Primer for REST How to build a REST API Documentation Standards Using a REST API as a client 4

+ Why we do care about the API? Integration, Integration, Integration IDC Predicts we are in the Golden Age of APIs We don t need a fancy GUI we need it to plugin to X Enterprises don t care about GUI, they want hardware to plugin to their Enterprise systems CINDER VASA Etc. Classically handled by CLI

What is a REST API? Wikipedia: Representational State Transfer (REST) is a software architecture style for building scalable web services. Objects are exposed as Uniform Resource Identifier (URI/URL) Object data is accessed via HTTP(S) and encoded in something easy to parse (Plain Text/JSON/XML) Other attributes Client/Server Stateless Cacheable Uniform 6

Why are they different/more useful? REST IS SIMPLE Like SOAP and XMLRPC, its Text Based No weird binary formats to parse Easy to consume by any language Relies on standard compression algorithms for speed Unlike SOAP, it is not overdesigned Its not even designed, it s a pattern No committees, grass roots It does not have a standard description language No IDL, WSDL, MIDL 7

Explore Simple Web Service + Lets look at a Demo 8

Technology + Primer for REST 9

Definitions HTTP Hyper Text Transfer Protocol HTTPS Secure HTTP (AKA, HTTP over SSL) Mime Type - is a two-part identifier to standardize file-formats across the Internet: (text/plain, text/html, application/json) SSL /TLS Secure Socket Layer / Transport Layer Security URL/URI The address of a resource (http://host:port/path) Query String Part of the URL after the question mark. Contains key/value data http://somehost.com/resource?key=value&key=value JSON Java Script Object Notation 10

HTTP Verbs GET Gets a Resource (What happens when you surf) POST Creates a new Sub Resource PUT Updates a resource DELETE Deletes or Resets a Resource HEAD Like GET but just gets the HEADERS OPTION Used in CORS TRACE / CONNECT Not really used in REST 11

Sample GET Request Client Server HTTP GET Host: somehost.domain.com Accept: application/json Accept-Langauge: en-us Status: ok Content-Type: application/json { message : Hello REST } 12

Common HTTP Headers Host Target Host Content-Type Mime Type for the inbound content Accept Mime Types that are acceptable responses Accept-Encoding Acceptable Encoding (zip, etc ) Status The Status code for the response (200,400,500 ) 13

How to build a REST API + 14

Building a REST Server All you really need is a way to generate dynamic content Frameworks can be a huge help Handles URL mapping to handlers Handles Language Object to Payload and back (JSON, XML etc ) REST Frameworks are everywhere Django for Python Certainly ones for.net Several Java Frameworks We will focus on Java because that is what I know 15

Simple Servlet @WebServlet(value ="/test", name = "SimpleRest") public class SimpleRest extends HttpServlet { protected void doget(httpservletrequest req, PrintWriter out; HttpServletResp resp) { out=new PrintWriter(response.getOutputStream()); resp.setheader("content-type","application/json"); out.println("{\"message\":\"hello World\"}"); out.flush(); out.close(); } } 16

JAX-RS Java Specification for REST API JSR 339 Set of annotations to define REST API Makes creating REST APIs pretty easy Don t tell my boss Jersey is an implementation of JSR 339 Jersey with Jackson is a frequent combination

JAX RS for Java Quick Example @Path("hello") public class HelloJersey { @GET @Produces("application/json") public ResponseOne handleget(){ ResponseOne ret; ret=new ResponseOne("Hello Jersey") } } return ret; 18

Response Class - POJO @XmlRootElement public class ResponseOne implements Serializable{ private String message; public ResponseOne() { } public ResponseOne(String message) { this.message = message; } public String getmessage() { return message; } } public void setmessage(string message) { this.message = message; } 19

Documenting REST APIs Good documentation is a Key to user acceptance! Quick search will find many options WADL Web Application Description Language Swagger A Open Source project for REST Various commercial offerings 20

Swagger World Swagger has a language neutral JSON representation of REST API There are tools to produce the JSON There is a Web UI project Reads the Swagger JSON definition of your API Presents interactive documentation Integrates with various languages

+ Swagger UI demo

Question? Do you start with documentation or do you start with code? +

+ Embedding Docs in Code How this works is obviously language specific For Java, Swagger tools read JAX-RS annotations and custom Swagger annotations Python s Django Framework uses Swagger

Using a + REST API

+ Lets start with a demo The Advance REST Client is a plugin for Chrome to test REST APIs curl is a command Unix command line for accessing web resources

+ SDK For REST APIs You don t need any special SDKs to consume a REST Server! All modern languages have libraries for HTTP. JSON processing is ubiquitous SDKs are a nice to have For strongly type languages like Java, having class definition is nice Swagger provides tools to generate client SDKs

Questions? +

Links https://jax-rs-spec.java.net/ http://www.django-rest-framework.org/ http://swagger.io/ http://www.w3.org/protocols/rfc2616/rfc2616.html https://jcp.org/en/jsr/detail?id=339 https://jersey.java.net/ http://wiki.fasterxml.com/jacksonhome 29