Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Donald F. Ferguson, 2014. All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson.

Similar presentations


Presentation on theme: "© Donald F. Ferguson, 2014. All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson."— Presentation transcript:

1 © Donald F. Ferguson, 2014. All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson Donald.Ferguson@software.dell.com (Admin: Kristina_Biehle@dell.com)

2 2 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Contents

3 3 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Contents Introduction –A little about me. –Course topics and schedule. –Assignments and grading. –Resources. Core Concepts –SOA, Web services, components. –Composite applications. –Examining the phrase “Modern Internet Service Oriented Application.” REST and SOA –Overview –Stateless, Idempotent –What can we learn from a relational datamodel? –Collections, keys, ad hoc query –Projection, partial update –Relationships and associations –Iteration, pagination –Metadata and reflection –Asynchronous operations –Events, notifications First assignment

4 4 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Introduction

5 5 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro A Little About Me … Career –Columbia –11 years as a student: B.A., M.S., M.Phil and Ph.D from Columbia University –Ph.D. Thesis – The Application of Microeconomics to the Design of Resource Allocation and Control Algorithms. –Previously taught 4 classes at Columbia –IBM –IBM Research for 10 years; IBM Software Group –Foundational work on web applications, J2EE and Web Services –IBM Fellow and Chief Architect for IBM Software Group –Microsoft –Technical Fellow –Technical strategy for future innovation in enterprise software –Initial work on BizTalk.net, and Integration-Platform-as-a-Service; Some concepts in Azure –CA technologies –Chief architect, Distinguished Engineer and CTO –Technical strategy and product architecture –Dell Software Group –Senior Fellow and CTO –Product architecture and technical strategy –Current focuses are cloud, cloud marketplaces, BYOD, IoT, iPaaS and next generation security Interests –Languages: Speak Spanish well. Learning Arabic slowly. Interested in linguistics and language theory. –Amateur astronomer –Road bicycling –Martial arts: Black belt in Kenpo karate; Krav Maga

6 6 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Tentative Course Schedule

7 7 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Assignments and Grading Grading –Grading will be based on –5, equally weighted, standalone team projects –5-6 page architecture/design paper. –Code review. –Demo. –You will provide a contribution percentage for each team member. –Class participation –Teams –Please form 4-5 person teams and let me know the members. –Send me an email if you cannot find a team, and I will form some teams. –You may change team membership between projects. –I will take team size into consideration when assessing. We will not have a midterm or final.

8 8 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Resources Unfortunately, there is no textbook(s) –Books tend to be out of date. –The course is surveying multiple topics, which would require many books. –The web tends to be the best source of documents and tutorials. Some books –I will be using parts of SOA Patterns by A. Rotem-Gal-Oz (978-1933988269) for some early parts of the course. –The classics are –“Patterns of Enterprise Application Architecture” by Martin Fowler. –“Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions” by Holpe and Wolf. –“SOA Design Patterns” by Thomas Erl. –http://www.enterpriseintegrationpatterns.com/ is a good, broad, shallow overview.http://www.enterpriseintegrationpatterns.com/ –The best programmer I have ever known, and someone who mentors new programmers, recommended “Domain- driven Design: Tackling Complexity in the Heart of Software” by Eric Evans. I have not read this book.

9 9 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Core Concepts

10 10 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro SOA DEFINITION Service-oriented architecture (SOA) is an architectural style for build­ing systems based on interactions of loosely coupled, coarse-grained, and autonomous components called services. Each service exposes processes and behavior through contracts, which are composed of messages at discoverable addresses called endpoints. A service’s behavior is governed by policies that are external to the service itself. The contracts and messages are used by external components called service consumers. Some observations – SOA is a reaction to distributed OO and RPC. –Coarse Grained and Messages –OO tends to lots of small classes/objects and fine-grain API calls (e.g. person.getIq()). –SOA tends to person.getState(). –Loosely coupled –Assume API calls “go remote” but may have local optimization. –Interfaces (Contracts) are not strongly typed, enabling independent evolution. –Endpoints –OO assumes “Java calling Java, perhaps over RMI.” –SOA separate Contract from Binding (WS-Interop, REST, message queues, etc). –Discoverable –OO assumes a classpath, findByClassName() and perhaps factory patterns. –SOA assumes you can go to a web callable repository and ask for SOA endpoints based on Contracts/Messages. –Web Services are a set of standards for SOA that enable interoperability.

11 11 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro SOA Various developer tools generate helper classes, allowing the programmer to focus on application logic and not details of formatting XML messages for SOAP. Services often go into containers that automate implementation of policies, e.g. transactions, security, reliable messaging.

12 12 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Composite Applications – Some Definitions “In computing, a composite application is a software application built by combining multiple existing functions into a new application. … A composite application consists of functionality drawn from several different sources. The components may be individual selected functions from within other applications, or entire systems whose outputs have been packaged as business functions, modules, or web services.” (http://en.wikipedia.org/wiki/Composite_application)http://en.wikipedia.org/wiki/Composite_application “Composition refers to a way of delivering enterprise solutions by assembling them from prebuilt components, instead of building them from scratch. It also includes personalization and customization abilities, so that users can easily and quickly modify specific functionality in the solution.” (http://msdn.microsoft.com/en- us/library/bb220803.aspx)http://msdn.microsoft.com/en- us/library/bb220803.aspx “A composite application orchestrates independently developed programs, data and devices to deliver a new solution that none of the previously available applications could deliver on its own. Each resource accessed by a composite application uses a different data model. In most cases, the composite application supports user interactions beyond those provided by the leveraged applications. In other cases, a composite application may act as a service. Some composite applications are built by leveraging other composite applications.” (http://www.gartner.com/it-glossary/composite-application-2)http://www.gartner.com/it-glossary/composite-application-2

13 13 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Composite Applications – Some Pictures

14 14 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Composites Start with Components

15 15 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Flexible Implementation – Some of which we will Cover

16 16 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro A Container: Application Server Architecture JNDI Sort of like DNS, but for APIs. Look up a provider of an API by a human name Resource Links The things I look up in JNDI. Configurable Instantiated connections JDBC JMS …

17 17 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Parsing the Course Title Modern Internet Service Oriented Application Development SOA –The same principles apply. –Evolving –From “coarse grained” meaning “big” to a lot of micro-services –Implemented using polyglot programming and persistence –Running in multiple, network addressable processes –That import the middleware functions they need versus being in containers. Internet –More natural usage of the Internet, e.g. –REST versus WSDL/SOAP –Google versus UDDI –Default web apps for API discovery versus WSDL. –And most of the business APIs and infrastructure APIs are “on the web.”

18 18 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Evolution Cart Functions Java SQLite Recommendation Functions Node.js Redis Catalog Functions PDP MongoDB XXX MMM NNN Content Functions Ruby Amazon S3

19 19 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Now – Much of what you need is “ on the web ”

20 20 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Now – Much of what you need is “ on the web ”

21 21 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro So, What are we going to study Technology for implementing services, e.g. –REST. –Various databases. –Web callable infrastructure, e.g. security, workflow. –Web callable business APIs. –Web/cloud friendly packaging and deployment, e.g. Docker. And “patterns” for “good implementation” –Implement basic services. –Assembly into composites. Weinberg's Second Law: If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.

22 22 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Example: Service Implementation Patterns

23 23 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Example: Service Composition Patterns http://www.eaipatterns.com/toc.html

24 24 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro REST and SOA

25 25 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro REST Overview

26 26 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Representational State Transfer (REST) People confuse –Various forms of RPC/messaging over HTTP –With REST REST has six core tenets –Client/server –Stateless –Caching –Uniform Interface –Layered System –Code on Demand

27 27 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro REST Tenets Client/Server (Obvious) Stateless is a bit confusing –The server/service maintains resource state, e.g. Customer and Agent info. –The conversation is stateless. The client provides all conversation state needed for an API invocation. For example, –customerCursor.next(10) requires the server to remember the client’s position in the iteration through the set. –A stateless call is customerCollection.next(“Bob”, 10). Basically, the client passes the cursor position to the server. Caching –The web has significant caching (in browser, CDNs, …) –The resource provider must –Consider caching policies in application design. –Explicitly set control fields to tell clients and intermediaries what to cache/when.

28 28 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro REST Tenets Uniform Interface –Identify/locate resources using URIs/URLs –A fixed set of “methods” on resources –myResource.deposit(21.13) is not allowed –The calls are –Get –Post –Put –Delete –Self-defining MIME types (Text, JSON, XML, …) –Default web application for using the API –URL/URI for relationship/association Layered System: Client cannot tell if connected to the server or an intermediary performing value added functions, e.g. –Load balancing –Security –Idempotency Code on Demand (optional): Resource Get can deliver helper code, e.g. –JavaScript –Applets

29 29 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro SSOL Page

30 30 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Anatomy of a URL SSOL for the Classlist https://ssol.columbia.edu/cgi- bin/ssol/DhbtiwfsFOMOeFQaDwqxAh/?p%.5Fr%.5Fid=k0F2vZ4ccAhzbcAg0Ql K4h&p%.5Ft%.5Fid=1&tran%.5B1%.5D%.5Fentry=student&tran%.5B1%.5D%. 5Fterm%.5Fid=20143&tran%.5B1%.5D%.5Fcid=COMSE6998&tran%.5B1%.5 D%.5Fsecid=005&tran%.5B1%.5D%.5Fsch=&tran%.5B1%.5D%.5Fdpt=&tran %.5B1%.5D%.5Fback=&tran%.5B1%.5D%.5Ftran%.5Fname=scrs This is –Not REST –This is some form of Hogwarts spell –This is even bad for a web page

31 31 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Anatomy of a URL HTTP://www.somedomain.edu/...The “server” containerHTTP://www.somedomain.edu/ …/ssol/…The module/component …/listManagerThe Application Object or …/Class/COMSE6998-01Entity Class (“Extent”) and ID.../WaitingList/…Contained Resource GET, POST, … on URLfor CRUD Some details –…/WaitlingList/dff9/IQPath navigation into resources –…/WaitlingList?op=“Approve”?CUID=“dff9”Method

32 32 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro What can we Learn from Data

33 33 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Database Model are Complex, even examples and samples, e.g. MySql Sakila Sample Database

34 34 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Some Concepts Foreign key relationships –Represent 1-1, 1-N relationships –Have “behavior,” e.g. –On Delete would prevent deleting a country if there is a city whose country_id is the country’s id. –On Cascade would automatically update all city.country_id when country.id changes Defining indices is important to avoid –Scanning the entire city table to –To find cities in a given country I would not put strings in a table for most words and string –Putting “Spain” for a country name –Prevents localization and national language enablement –Use symbols into localization resource bundles

35 35 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Views and Stored Procedures

36 36 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro What can we Learn? The implementation of the SOA contract/REST interface –Is a set of verbs on URLs –That manipulate a logical data model. Every logical data model has a common set of concepts that materialize through REST –ID  URI/URL –Collections supporting –Primary key  …/Customers/21 –Non-unique, secondary keys  …/Customers/Zipcode/12345 –Ad hoc query (SELECT WHERE (… …))  …/Customers?q=“id<=50&lastname=Ferguson” –Projection –SELECT iq, lastname FROM Customers  …/Customers?”Fields=iq,lastname” –UPDATE iq, shoessize WHERE …  PUT {{iq, “50},{…}}  …/Customers –Foreign keys/join tables  Hyperlinks –Iterators –SELECT * FROM Customers CREATE Cursor …  –GET …/Customers?Offset=40&Pagesize=20 –Thread/callback/promise  Asynchronous REST responses –Metadata/reflection: SQL DESCRIBE TABLE  Web UI for driving the REST API –Stored procedures  PUT…/Commands/… –Events/Notifcations  Feeds

37 37 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Asynchronous Operation

38 38 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro 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 …/Customer –The data format in the table is {id, status, JSONString} 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.

39 39 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Ad Hoc Query Every collection should support ?q=“… …” –…/Customers?q=“lastName=21&IQ<21” –q is a string encoding a set of triplets with elements –Resource field, e.g. “lastName” –Comparison operation, e.g. “=“, “>”, … –Comparison value. Your code needs to –Parse and validate the query string. –Rewrite the string in the query language of the underlying database, e.g. Where clause in SQL –Execute the query –Refine the result set if the underlying database does not support query capabilities that you are surfacing through your API.

40 40 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Pagination {“data”: [{“user_id”:”42”, “name”:”Bob”, “links”:[{“rel”:”self”, “href”:”http://api.example.com/users/42”}]}, {“user_id”:”22”, “name”:”Frank”, “links”: [{“rel”:”self”, “href”:”http://api.example.com/users/22”}]}, {“user_id”:”125”, “name”: “Sally”, “links”:[{“rel”:”self”, “href”:”http://api.example.com/users/125”}]}], “links”: [{“rel”:“first”, “href”:”http://api.example.com/users?offset=0&limit=3”}, {“rel”:“last”, “href”:”http://api.example.com/users?offset=55&limit=3”}, {“rel”:“previous”, “href”:”http://api.example.com/users?offset=3&limit=3”}, {“rel”:”next”, “href”:”http://api.example.com/users?offset=9&limit=3”}]}

41 41 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Implementation Considerations Query rewrite –…/Customers?q=“lastname=Ferguson&id<5”&limit=10&offset=5 –Neatly translates into an SQL statement –Select * from customers where … limit=5 offset=5 Other databases have similar concepts. You may have to –Rewrite a push the query down –Build a result cache in another store that supports limit/offset –Paginate through the cache You should also consider adding –“field=lastname,IQ,color” –To enable selecting a subset of fields

42 42 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Some Complex Topics

43 43 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro 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, …

44 44 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Endpoint /a/b/c?x=7&y=21 is a pretty straightforward concept, but … –How do I get info about customer “Ferguson?” –…/Customer/Ferguson/Donald –…/Customer?lastName=“Ferguson”&firstName=“Donald” –??? –Do I really want to –Find info about Don using …/Customer/Ferguson/Donald –Find info about agent using …/Agents?id=“21” –How does it work if I can find customer by name or phone number? –How do I set a relationship between customer and agent? –PUT …/Relationship/AgentFor?agent=“21”&”Customer=“Ferguson” –Or two PUTS, one on Customer and one on Agent? In the same way you have to define a framework for your application, you have to define a shape/pattern in your REST API model.

45 45 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro 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

46 46 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Response Codes OperationHTTP RequestHTTP Response Codes Supported READGET 200 - OK with message body 204 - OK no message body 206 - OK with partial message body CREATEPOST 201 - Resource created (Operation Complete) 202 - Resource accepted (Operation Pending) UPDATEPUT 202 - Accepted (Operation Pending) 204 - Success (Operation Complete) DELETE 202 - Accepted (Operation Pending) 204 - 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.

47 47 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro 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

48 48 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Design Pattern Choices Resource Requests Collectionhttps://ENDPOINT/NAMESPACE/RESOURCE[?QUERY_PARAMETERS] Resourcehttps://ENDPOINT/NAMESPACE/RESOURCE/RESOURCE_ID[?QUERY_PARAMETERS] Collection OperationHTTP Request Get all items in the collection GET /collection Should also return the URI of the collection itself. Get an particular item in the collectionGET /collection/itemId Get items match certain criteriaGET /collection?property1=’value’ Add a new item to the collection POST /collection contents of new item … Get items starting at 100 with page size=25 GET /collection?start=100&pageSize=25 Support for Map Array Collection

49 49 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Relationships {“membership”: { “URI” : “http://dell.com/memberships/m12356”,http://dell.com/memberships/m12356 “created” : “2013-08-01T12:00:00.0Z”, “owner” : “user123456”, “expire” : “never”, “group” : { “ref” : “http://dell.com/groups/g123456” },http://dell.com/groups/g123456 “server” : { “ref” : “http://dell.com/servers/s123456”}http://dell.com/servers/s123456 } "link": { "href": "http://dell.com/api/resource1",http://dell.com/api/resource1 "rel": "self", “title” : “server-s123456” } Relationship as a resource Relationship as a field in resource

50 50 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Navigating Through Result Set GET on collections, maps, … needs pagination and cursors –Limit: What is the maximum number of elements you want? –QueryID: A tag for the query that produced the original result set –Offset references a specific element in a “page.” There is a standard for linking resources in logical sets, e.g. –Link: ; rel="previous"; title="previous chapter“> –Indicates that "chapter2" is previous to this resource in a logical navigation path. Your API/framework can use this for result sets –Example 1 –GET /api/customers?status=“Gold” returns some number of “Gold” customers and –Link Header for “next page” is Link: ; rel="next last“ –Which is the URL for the “cursor.next set,” which has 50 elements and is also “last” –Example 2 –Get returns the “next” from example 1 –With Link Link: ; rel="prev first" –Allowing you to go backwards to the previous “page.”

51 51 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro What ’ s Next?

52 52 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Next Steps The first project will be (assign next week) –Implementing a well-designed REST API, e.g. –Sensible use of URLs and verbs –Handling links properly –Pagination –Partial get/update –Encapsulating a simple, but complex enough data model, e.g. –Primary keys, secondary keys –Foreign keys –Relational integrity semantics The next step for you is to –Set up a development/runtime environment, e.g. –LAMP –node.js –Play around with surfacing REST APIs and connecting to a database. We will start examining more complex topics once we can build a “component.”

53 53 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Backup

54 54 © Donald F. Ferguson, 2015. All rights reserved.Modern Internet Service Oriented Application Development – Lecture 1: Introduction, Core Concepts, REST Intro Views


Download ppt "© Donald F. Ferguson, 2014. All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Dr. Donald F. Ferguson."

Similar presentations


Ads by Google