RESTful Services. Distributed Enabling Platform

Similar documents
INFO/CS 4302 Web Informa6on Systems

ReST 2000 Roy Fielding W3C

04 Webservices. Web APIs REST Coulouris. Roy Fielding, Aphrodite, chp.9. Chp 5/6

Develop Mobile Front Ends Using Mobile Application Framework A - 2

PS/2 Web Services

RESTFUL WEB SERVICES - INTERVIEW QUESTIONS

Other architectures are externally built or expanded

REST Easy with Infrared360

Service Oriented Architectures (ENCS 691K Chapter 2)

Session 12. RESTful Services. Lecture Objectives

Web Services Week 10

Kim Dalsgaard. Co-owner of, and Software Designer at Trifork Athene Co-founder of Aarhus Ruby Brigade

HTTP, REST Web Services

SERVICE TECHNOLOGIES

REST in a Nutshell: A Mini Guide for Python Developers

WWW, REST, and Web Services

RESTful Web Services. 20-Jan Gordon Dickens Chariot Solutions

REST. And now for something completely different. Mike amundsen.com

What is REST? ; Erik Wilde ; UC Berkeley School of Information

REST Web Services Objektumorientált szoftvertervezés Object-oriented software design

Understanding RESTful APIs and documenting them with Swagger. Presented by: Tanya Perelmuter Date: 06/18/2018

Services Web Nabil Abdennadher

Lesson 14 SOA with REST (Part I)

Just relax - take some 90 minutes of ReST

Oracle RESTful Services A Primer for Database Administrators

REST Services. Zaenal Akbar

Mobile Computing. Logic and data sharing. REST style for web services. Operation verbs. RESTful Services

Create and Secure Your REST APIs with Apache CXF

Life on the Web is fast and furious should we be more RESTful?

There is REST and then there is REST. Radovan Semančík November 2017

SENG3011 Implementation Workshop. More on REST services

Short introduction to REST

Web Application Development

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

INF 212 ANALYSIS OF PROG. LANGS. INTERACTIVITY. Prof. Crista Lopes

Lesson 15 SOA with REST (Part II)

Developing RESTful Services Using JAX-RS

REST API s in a CA Plex context. API Design and Integration into CA Plex landscape

JVA-563. Developing RESTful Services in Java

Copyright 2014 Blue Net Corporation. All rights reserved

RESTful Java Web Services

WWW Architecture. Software Architecture VO/KU ( / ) Denis Helic. KMI, TU Graz. Dec 7, 2011

RESTful -Webservices

StorageGRID Webscale NAS Bridge Management API Guide

Web-APIs. Examples Consumer Technology Cross-Domain communication Provider Technology

Protocols. Application Layer FTP, HTTP, SSH, IMAP. Transport Layer TCP, UDP. Internet Layer IP. Link Layer Ethernet, WiFi

Sriram Krishnan, Ph.D. NBCR Summer Institute, August 2010

SRIJAN MANANDHAR MQTT BASED COMMUNICATION IN IOT. Master of Science thesis

ORACLE APPLICATION EXPRESS, ORACLE REST DATA SERVICES, & WEBLOGIC 12C AUTHOR: BRAD GIBSON SENIOR SOLUTIONS ARCHITECT ADVIZEX

JSR 311: JAX-RS: The Java API for RESTful Web Services

Software Design COSC 4353/6353 DR. RAJ SINGH

Introduction to RESTful Web Services. Presented by Steve Ives

RESTful Web services

Distributed Systems 1

Introduction to REST. Kenneth M. Anderson University of Colorado, Boulder CSCI 7818 Lecture 6 08/27/2008. University of Colorado 2008

REST A brief introduction

Reviewing the API Documentation

INF5750. RESTful Web Services

ITP 140 Mobile Technologies. Mobile Topics

DatabaseRESTAPI

EMC Unisphere for VMAX

HTTP, circa HTTP protocol. GET /foo/bar.html HTTP/1.1. Sviluppo App Web 2015/ Intro 3/3/2016. Marco Tarini, Uninsubria 1

INTERNET ENGINEERING. HTTP Protocol. Sadegh Aliakbary

Web basics: HTTP cookies

Atomic Transactions for the REST of us

How to work with HTTP requests and responses

Web API Best Practices

Discussion #4 CSS VS XSLT. Multiple stylesheet types with cascading priorities. One stylesheet type

TRANSFER MANAGER 2017

STANDARD REST API FOR

How is state managed in HTTP sessions. Web basics: HTTP cookies. Hidden fields (2) The principle. Disadvantage of this approach

Backends and Databases. Dr. Sarah Abraham

SOA & REST. Ola Angelsmark

Developing Applications for the Java EE 7 Platform 9-2

Microservices. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Restful Application Development

PRISMTECH. RESTful DDS. Expanding the reach of the information backbone. Powering Netcentricity

Understanding REST: ROCA & HATEOAS

Agenda. Introduction. Supported Formats. Creating a Custom REST Service. What s Next

1.1 A Brief Intro to the Internet

Management Tools. Management Tools. About the Management GUI. About the CLI. This chapter contains the following sections:

Introduction to REST Web Services

DATABASE SYSTEMS. Database programming in a web environment. Database System Course, 2016

Copyright 2012, Oracle and/or its affiliates. All rights reserved.

Towards a more RESTful world. Anurup Joseph Elegan Consulting

Web basics: HTTP cookies

Module 3 Web Component

CS 5450 HTTP. Vitaly Shmatikov

Web Development and HTML. Shan-Hung Wu CS, NTHU

Designing RESTful Web Applications. Ben Ramsey

Hypertext Transport Protocol

Network Programmability with Cisco Application Centric Infrastructure

REST as a better web service paradigm

Backends and Databases. Dr. Sarah Abraham

ITP 342 Mobile App Development. APIs

REST. Lecture BigData Analytics. Julian M. Kunkel. University of Hamburg / German Climate Computing Center (DKRZ)

World-Wide Web Protocols CS 571 Fall Kenneth L. Calvert All rights reserved

CS 355. Computer Networking. Wei Lu, Ph.D., P.Eng.

Developing Enterprise Services for Mobile Devices using Rational Software Architect / Worklight

Restful Interfaces to Third-Party Websites with Python

Transcription:

RESTful Services 1

https://dev.twitter.com/docs/api 2

http://developer.linkedin.com/apis 3

http://docs.aws.amazon.com/amazons3/latest/api/apirest.html 4

Web Architectural Components 1. Identification: URI uniform resource identifier 2. Interaction: HTTP hypertext transfer protocol 3. Standard Document Format: HTML, XML, JSON hypertext markup language extensible markup language javascript object notation 5

URIs URIs identify interesting things in the Web documents on the Web relevant aspects of a data set A URN (uniform resource name) defines an item's identity A URN functions like a person's name A URL (uniform resource locator) provides a method for finding an item A URL resembles that person's street address, while A URI can be a URL, a URN or both 6

URI Examples HTTP URIs name and address resources in a Web system A URI names and identifies one resource A resource can have more than one name http://example.com/software/latest-release http://example.com/software/release-1.4 A resource can have several representations: 7

Interacting with resources We interact with resource representations not the resources themselves representations can be in any format defined by media type Each resource implements a standard uniform interface: HTTP a small set of verbs applied to a large set of nouns verbs are universal and not invented on a per-application basis Resources Representations HTML Client XML HTTP JSON Uniform Interface Server Resource Resource Resource Logical Resources Physical Resources 8

REST and ROA Representational State Transfer (REST) Based on chapter 5 of Roy Fielding s PhD thesis (2000) An architectural style for building loosely coupled systems The Web itself is an instance of that style Can be used to build Web services Resource Oriented Architecture (ROA) A set of design principles to build RESTful Web services 9

Addressability Uniform Interface Connectedness Statelessness Architectural Principles 10

Addressability An addressable application - exposes the interesting aspects of its dataset as resources - exposes a URI for every piece of information it might serve - which is usually an infinite number of URIs A resource - is anything that is important enough to be referenced as a thing in itself - usually something that you want to serve information about that can be represented as a stream of bits actors movies - a resource must have at least one name (URI) Resource names - the URI is the name and address of a resource - resource s URI should be descriptive: GOOD: http://example.com/movies! BAD: http://example.com/overview.php?list=all,type=movie 11

Uniform Interface The same set of operations applies to everything (every resource) A small set of verbs (methods) applied to a large set of nouns (resources) Verbs are universal and not invented on a per-application base - Natural language works in the same way (new verbs rarely enter language) HTTP defines a small set of verbs (methods) for acting on URI-identified resources! RESTful Web Services use HTTP to its full extent - Methods: GET, POST, PUT, DELETE, (...) - Request headers: Authorization, Content-Type, Last-Modified - Response Codes: 200 OK, 304 Not Modified, 401 Unauthorized, 500 Internal Server Error - Body: an envelope for data to be transported from A to B 12

CRUD with HTTP With HTTP we have all methods we need to manipulate Web resources CRUD interface: - Create = POST (or PUT) - Read = GET - Update = PUT - Delete = DELETE Safe and idempotent behavior - Safe methods can be ignored or repeated without side-effects: GET and HEAD - Idempotent methods can be repeated without side-effects: PUT and DELETE - Unsafe and non-idempotent methods should be treated with care: POST 13

CREATE CREATE a new resource with HTTP POST 14

POST Semantics POST creates a new resource The server decides on the resource s URI POST is not idempotent - A sequence of two or more POST requests has side-effects - Human Web: Do you really want to post this form again? Are you sure you want to purchase that item again? - Programmatic Web: if you post twice, you create two resources 15

READ READ an existing resource with HTTP GET 16

GET Semantics GET retrieves the representation (i.e., the current state) of a resource GET is safe (implies idempotent) - does not change state of resource - has no side-effects If GET goes wrong - GET it again! - no problem because it safe (and idempotent) 17

UPDATE UPDATE an existing resource with HTTP PUT 18

PUT Semantics PUT creates a new resource The client decides on the resource s URI PUT is idempotent - multiple PUT requests have no side effects - but it changes the resource state 19

DELETE DELETE an existing resource with HTTP DELETE 20

DELETE Semantics Stop the resource from being accessible - logical delete - not necessarily physical If DELETE goes wrong - try it again! - DELETE is idempotent 21

Representations in HTTP In HTTP, the format of a resource is identified through a MIME code - Multimedia Internet Mail Extension - format: type/subtype Examples: - text/plain, text/html - application/xml - image/jpeg 22

Connectedness RESTful services representations are hypermedia documents These are documents that contain not just data, but links to other resources The server guides the client's path by serving hypermedia : links and forms inside hypertext representations The server sends the client guidelines about which states are near the current one. The quality of having links is called connectedness. Resources should link to each other in their representations. Hence, why the human web is easy to use because it is well connected 23

Statelessness Statelessness = every HTTP request executes in complete isolation The request contains all the information necessary for the server to fulfill that request The server never relies on information from a previous request - if information is important (e.g., user- authentication), the client must send it again This constraint does not say stateless applications! - for many RESTful applications, state is essential (e.g., shopping carts) It means to move state to clients or resources State in resources - the same for every client working with the service - when a client changes resource state other clients see this change as well State in clients (e.g., cookies) - specific to client and has to be maintained by each client makes sense for maintaining session state (login / logout) 24

Tools and Frameworks Restlet - framework for mapping REST concepts to Java classes - http://www.restlet.org Django - framework for building RESTful Web applications in Python - http://django-rest-framework.org Ruby on Rails - a framework for building RESTful Web applications - http://www.rubyonrails.org/ JAX-RS - a specification provides a Java API for RESTful Web Services over the HTTP protocol - https://jax-rs-spec.java.net Jersey - the open source reference implementation of JAX-RS - https://jersey.java.net RESTEasy - JBoss project that provides various frameworks for building RESTful Web Services and RESTful Java applications. Fully certified JAX-RS implementation. - http://www.jboss.org/resteasy/ 25