Presentation is loading. Please wait.

Presentation is loading. Please wait.

ADVANTAGE WEBAPI PETER FUNK SOFTWARE ENGINEER, ADVANTAGE R&D MAY 20, 2011.

Similar presentations


Presentation on theme: "ADVANTAGE WEBAPI PETER FUNK SOFTWARE ENGINEER, ADVANTAGE R&D MAY 20, 2011."— Presentation transcript:

1 ADVANTAGE WEBAPI PETER FUNK SOFTWARE ENGINEER, ADVANTAGE R&D MAY 20, 2011

2 2 – Advantage Technical Summit – May 2011 AGENDA Introduction REST Framework Security Authentication Database specific Client development pattern

3 3 – Advantage Technical Summit – May 2011

4 4 – Advantage Technical Summit – May 2011 INTRODUCTION ADS WebAPI implements a RESTful web service Accessible from any client that can implement HTTP web requests Requirements of a client’s library (PUT, GET, POST, DELETE), SSL, basic authentication Data dictionary ADS 10.10 (latest EBF, work in progress)

5 5 – Advantage Technical Summit – May 2011 REST Representational State Transfer (ReST) Client and server architecture, stateless Client transitions from states or at “rest” when idle – Transitions during requests – Interacts with user while at rest Uses links (URIs) to initiate a new state transition Each request contains all information to service the request Methods GET (SELECT), PUT (UPDATE), POST (INSERT), DELETE (DELETE) Recommended reading: RESTful Web Services by Leonard Richardson and Sam Ruby

6 6 – Advantage Technical Summit – May 2011 FRAMEWORK oData – Open Data Protocol (odata.org) – Web protocol for querying and updating data – Built on top of HTTP, AtomPub, and JSON AtomPub (Atom Publishing Protocol) – XML JSON – JavaScript Object Notation (json.org) – Lightweight data-interchange format – Easy to read, parse, and generate

7 7 – Advantage Technical Summit – May 2011 EXAMPLE XML demo10 http://server/adsweb/exampledb/v1/tables/demo10 http://server/adsweb/exampledb/v1/tables/demo10(5) 18 Costello Angie 1989-07-16T00:00:00 true 5 381-8410 1948-04-19T00:00:00 7066 538-62-6755 true Production Los Angeles http://server/adsweb/exampledb/v1/tables/demo10(5)

8 8 – Advantage Technical Summit – May 2011 EXAMPLE JSON { "d": { "results": [ { "__metadata": { "uri": "http://server/adsweb/exampledb/v1/tables/demo10(5)", "key_fields": "EMPID", "rows_affected": 0, "last_autoinc": 0 }, "DEPTNUM": 18, "LASTNAME": "Costello", "FIRSTNAME": "Angie", "DOH": "1989-07-16T00:00:00", "SALARIED": true, "EMPID": 5, "PHONE": "381-8410", "DOB": "1948-04-19T00:00:00", "EXTENSION": 7066, "SOC_SEC_NU": "538-62-6755", "MARRIED": true, "DIVISION": "Production", "BRANCH": "Los Angeles" } ] } http://server/adsweb/exampledb/v1/tables/demo10(5)?$format=json

9 9 – Advantage Technical Summit – May 2011 APACHE MODULE WebAPI is an Apache module that communicates with ADS Security updates to Apache, not ADS Configurable with ads.conf – Authentication – SSL – Expose your database  Connection strings

10 10 – Advantage Technical Summit – May 2011 SECURITY Outward security handled by Apache – Keep Apache up to date – Web server & database server on separate machines Require SSL (Secure Sockets Layer) – Encryption – Certificate  Self signed for testing  Official for production

11 11 – Advantage Technical Summit – May 2011 AUTHENTICATION DbAuthentication – “None”: No authentication required. Note if Apache is not prompting for authentication, you will very likely want to only expose this data as a read-only feed. To accomplish this, set up a database user with read-only privileges, and specify that username and password in your DbConnection string. It would be a great idea to test this setup by trying to perform an update as well. – “Database” (default): User credentials will be prompted for, and routed to Advantage for verification via existing user accounts in the database. – “Apache”: Used if you would rather use an Apache module for authentication. If specified, you must then provide Apache directives for your specific module. For example, you could use the AuthBasicProvider and AuthUserFile directives to implement authentication via an Apache passwd file. Note if you use “Apache” authentication you must then provide a database username and password in your DbConnection string.

12 12 – Advantage Technical Summit – May 2011 DATABASE SPECIFIC Conflicts – Rowversion, modtime Stored procedures and triggers Transactions on server-side only or with batch updates Primary keys Non-nullable fields Data Dictionary Binary data is base64 encoded/decoded – QURTIFJ1bGVzIEJhYnkh

13 13 – Advantage Technical Summit – May 2011 DEVELOPMENT PATTERN HTTP request XML or JSON deserialization Proxy classes – Look for client libraries that can make these easy for you Utilities – LINQPad – Fiddler – Chrome Browser – Curl

14 14 – Advantage Technical Summit – May 2011 FUTURES oData specification evolving – Delta links provide updates to data stored locally on the client Apache packaged with ADS install – Apache updates with ADS updates (EBFs)

15 15 – Advantage Technical Summit – May 2011 GETTING STARTED Advantage Web API blog post – http://jdmullin.blogspot.com/2010/09/advantage-web-api.html http://jdmullin.blogspot.com/2010/09/advantage-web-api.html Web API Quick Start Guide – https://docs.google.com/document/d/1dQsxVf8K0t4HmHvNoaAgx2c_UTDnoo1cTVNHvAjtD78/edit?hl=en&authkey=CNCJj44B https://docs.google.com/document/d/1dQsxVf8K0t4HmHvNoaAgx2c_UTDnoo1cTVNHvAjtD78/edit?hl=en&authkey=CNCJj44B Beta user signup – http://www.surveymonkey.com/s/D3R6NGS http://www.surveymonkey.com/s/D3R6NGS User group forums – news://DevZone.AdvantageDatabase.com/advantage.webapi news://DevZone.AdvantageDatabase.com/advantage.webapi All things oData – http://www.odata.org http://www.odata.org – http://www.odata.org/developers/odata-sdk http://www.odata.org/developers/odata-sdk Client libraries –.NET JSON.NET http://james.newtonking.com/pages/json-net.aspxhttp://james.newtonking.com/pages/json-net.aspx – Java Restlet http://www.restlet.org/http://www.restlet.org/ – Ruby ruby_odata https://github.com/visoft/ruby_odatahttps://github.com/visoft/ruby_odata – iOS Objective-C http://odataobjc.codeplex.com/http://odataobjc.codeplex.com/

16 16 – Advantage Technical Summit – May 2011 VIDEOS Consuming oData from.NET (and other MS environments) – http://msdn.microsoft.com/en-us/data/video/gg591296 http://msdn.microsoft.com/en-us/data/video/gg591296


Download ppt "ADVANTAGE WEBAPI PETER FUNK SOFTWARE ENGINEER, ADVANTAGE R&D MAY 20, 2011."

Similar presentations


Ads by Google