1 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Some.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Connecting Social Content Services using FOAF, RDF and REST Leigh Dodds, Engineering Manager, Ingenta Amsterdam, May 2005.
Siebel Web Services Siebel Web Services March, From
Hypertext Transfer PROTOCOL ----HTTP Sen Wang CSE5232 Network Programming.
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
Recruitment Booster.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
General introduction to Web services and an implementation example
Building RESTful Interfaces
PantherSoft Financials Smart Internal Billing. Agenda  Benefits  Security and User Roles  Definitions  Workflow  Defining/Modifying Items  Creating.
PHP (2) – Functions, Arrays, Databases, and sessions.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
JavaScript & jQuery the missing manual Chapter 11
INTERNET APPLICATION DEVELOPMENT For More visit:
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Jonathan Westlake, ed: Nic Shulver JSP, Structure and JavaBeans JSP models Assignment context “Register as a member of the site/show member details/update.
GET Examples – db.org/sops/3/experimental_conditions/55http://seek.sysmo- db.org/sops/3/experimental_conditions/55 –
CollectionSpace Service REST-based APIs June 2009 Face-to-face Aron Roberts U.C. Berkeley IST/Data Services.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
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.
Open Data Protocol * Han Wang 11/30/2012 *
Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge
SNOWTAM Trial: REST Interface. AIXM XML Developers' Seminar 2 Contents Digital-SNOWTAM Trial Introduction REST Introduction REST in the Digital-SNOWTAM.
22 November Databases. Presentations Tega: news 1954 Prediction.
1 Web Services Web and Database Management System.
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.
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: COMS E Micro-service Application and API Development Lecture.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
SCIM conference call 4 September Issue #2 Add pagination capability to plural Resource attributes User Group retrieval could be resource intensive,
© Donald F. Ferguson, All rights reserved. Topics in Modern Internet Application Development: Project 1a Observations, Message Queuing, REST, Composite.
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.
1 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Some.
© Donald F. Ferguson, All rights reserved. Topics in Modern Internet Application Development: Iteration, REST, Composite Applications, Pub/Sub Dr.
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.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson.
ASSIGNMENT 2 Salim Malakouti. Ticketing Website  User submits tickets  Admins answer tickets or take appropriate actions.
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: COMS E Micro-service Application and API Development Lecture.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Some More on REST;
SOAP, Web Service, WSDL Week 14 Web site:
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
How to consume a RESTful service using jQuery. Introduction  In this post we see how to consume the RESTful service described in the post Design a RESTful.
Programming for RESTful-SOA An introduction to building a SOA System with light-weighted RESTful Web Services (Web Services without SOAP or WSDL) Xiong.
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson.
National College of Science & Information Technology.
Database and Cloud Security
British Library Document Supply Service (BLDSS) API
Hypertext Transfer Protocol
Content from Python Docs.
Better RESTFul API – Best Practices
z/Ware 2.0 Technical Overview
Data Virtualization Tutorial… CORS and CIS
Node.js Express Web Services
An introduction to REST for SharePoint 2013
Ashish Pandit IT Architect, Middleware & Integration Services
Testing REST IPA using POSTMAN
WEB API.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
WEB SERVICES From Chapter 19, Distributed Systems
Week 05 Node.js Week 05
Presentation transcript:

1 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Some Details

2 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Asynchronous Operations Assembling applications from micro-services is “cool” But, getting a response to a GET or PUT might take a while –The action implementation requires talking to other micro-services, which in turn talk to other micro-services. –You need to assume that calls are occurring over a network. –Some operations take a little while, e.g. a complex DB query. –Some micro-services are inherently asynchronous, e.g. because they are people –PUT …/account/21 with some data has an implementation –That sends and to Bob who has to make sure the account data is OK –And sends an “approved” or “not approved” response –Before the original PUT can return success or failure Holding the “connection” while a long task is running is icky –Consumes resources and may block other calls due to limits on active requests –Network are unreliable, and connections break. This can result in really icky –My PUT failed. I will try again. –Failed again. I will try again. –… …

3 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Asynchronous Operation

4 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Implementation Observations Define a collection /QueuedResponses –A client can call …/QueuedResponses/21 to get a specific response. –You already know how to do this for …/staff, …/stores –The data format in the table is {id, status, JSONString}, where JSONString is the response you would have received for a synchronous request. A simple implementation would be writing a façade –Accept request –Create new table entry with status = “in progress” –Return 202 and URL –Call the actual implementation –Update the database table entry with the JSON result Most application platforms have middleware approaches to support registering callbacks, threads, etc. The implementation would typically –Invoke some long running action, e.g. DB query, workflow process and register a callback –The callback implementation updates the entry in the response table.

5 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Example Considerations Service Endpoint –Endpoint –Endpoint Encryption Requests and Authentication –Request Headers –Request Timestamps –Request Authentication –Response Headers Resources –Resource Requests –Resource Representation –Resource Methods –Synchronous Operations –Asynchronous Operations –Success Response Codes –Failure Response Codes Resource Data Types –Atomic Types –Complex Type - Object or Structure –Resource Relationships –Resource References Pagination –Through HTTP Link Header –Syntax and Example of Pagination Link Header –Consistency Across Page Requests Versioning –Version Header –Version URI Saying “REST is not enough You have to define a set of patterns/ conventions of URLs, headers, …

6 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Headers – Some Choices I Made HTTP Request HeaderValueMandatory auth-timestamp:The current POSIX time.Yes auth-key: The user or client’s unique API KEY. Yes auth-signature: The HMAC-SHA256 digest for the request. Yes api-version:(Optional) API version stringNo Accept: (Optional) application/xml or application/json No Nonce:One time UUID to enable idempotency/duplicate detection

7 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Response Codes OperationHTTP RequestHTTP Response Codes Supported READGET OK with message body OK no message body OK with partial message body CREATEPOST Resource created (Operation Complete) Resource accepted (Operation Pending) UPDATEPUT Accepted (Operation Pending) Success (Operation Complete) DELETE Accepted (Operation Pending) Success (Operation Complete) Examples of Link Headers in HTTP response: Link: ;rel=monitor;title="update profile" Link: ;rel=summary;title=”access report” 202 means Your request went asynch. The HTTP header Link is where to poll for rsp.

8 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Failure Response Code ErrorResponse Code Invalid Parameter400 - Invalid parameter Authentication401 - Authentication failure Permission Denied403 - Permission denied Not Found404 - Resource not found Invalid Request Method405 - Invalid request method Internal Server Error500 - Internal Server Error Service Unavailable503 - Service Unavailable

9 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Assignment 1

10 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Setup Form teams –If you have already formed your team, –Give your team a “name.” –Elect a leader. If you cannot elect a leader using Rock-Paper-Lizard-Scissors-Spock, or something similar. –The leader sends me an of the form “Our team is the Bobcats Bobcats, dff9, Ferguson, Donald, Bobcats, js2001, Smith, John, Bobcats, gw1031, Washington, George, –If you have not formed your teams, –Why not? –I think maybe 2 people sent s saying they do not have a team. –I will form teams randomly at the break. Perform the following computation –Form a set that is all of the team members UNIs without the text prefix. –Choose the smallest number in the set, which we will call x –Compute N = x MOD 3 –If –N = 0, your team’s datamodel is Customer Data –N = 1, your team’s datamodel is Movie Information –N = 2, your team’s datamodel is Business –N = 3, you do not know what MOD means

11 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns The Project Setup –You may pick any language, runtime, framework, DB, … you want. –You will create a database “schema” for you model and populate with sample data –You do not need to rigorously adhere to “table” and “column” names Implement a REST service for your information model with –A resource representation for each “type” in the model, e.g. store, staff –GET, PUT, POST and DELETE operations for each “type” –Navigable relationships, e.g. …/store/manager –All PUT operations must implement an asynchronous response, e.g. Receive request, response accepted with link to rsp, sleep(x),update the response –Implement a template based query language, e.g. –…/humans?q=“iq=50&hairColor=red” with only “=“ operators –That returns the collection elements with fields equal to the input –Pagination –Projection: –GET …/humans?fields=“iq,shoeSize” returns –PUT contains a JSON object with the fields to update

12 © Donald F. Ferguson, All rights reserved.Modern Internet Service Oriented Application Development – Lecture 2: REST Details and Patterns Grading The grade for the project is based on –Top-Level Design Spec –Demo –Code review Top-Level Design Spec structure –Introduction –Uniform Resource Representation: –How your API surfaces each of the concepts –A couple of examples –Implementation technology you used –Implementation –How you implemented each of the concepts –A couple of examples –Issues Due dates –Your design document is due 06-February –We will do code reviews and demos via eMeetings the week of 09-February Do not panic! I will help you if you are confused/unsure. Just do the best you can. I will provide feedback on the first version. Do not panic!