Ben Burbridge, Rebecca Jones, Hilary Newman Product Development The Open System Ben Burbridge, Rebecca Jones, Hilary Newman Product Development
The Open System Access to Your Data Integrate With Other Systems Reports We Couldn’t Anticipate Ad Hoc Reports – Unique to You Write Applications Partnering for Improved User Services
Sierra Back-end Persistence Sierra uses the PostgreSQL relational database as its “system of record” Innovative will provide direct access to the database Technically, libraries will be writing queries and reports against database ‘views’ Sort of a ‘roll your own’ create lists
What is a ‘view’? A view is a ‘façade’ in front of one or more tables that you can query as a single, simple “table” No data is stored with a view They are read-only They can contain any SQL SELECT statement ‘Join’ multiple tables together Filter the result Sort the result and more…
View Example Corresponding Underlying tables ‘Helper’ View SELECT from the view SELECT from the tables SELECT a.icode, b.description FROM icode a join icode_18n_desc b on b.icode_id = a.id join language c on b.language_id = c.id WHERE c.lang_code = {current user’s language code} SELECT * FROM icode_view_myuser icode description ---- ----------- b book c cd-rom d dvd both return:
View Guiding Principles Insulate you from changes to the underlying tables and columns so that we don't break your reports Ease querying for the report Present multiple tables as ‘one’ (simplify) Filter the rows Etc Expose new data as soon as it is available
Types of Views ‘Generated‘ Views ‘Helper‘ Views One-to-one with the underlying tables Available for querying at the lowest-level ‘Helper‘ Views Innovative-developed views that join many tables into one Simplify a complex (transactional) data model for reporting purposes
Challenges in managing and documenting Sheer volume 300+ tables and growing 2500+ columns and growing Constant change New tables (or new columns on existing tables) appearing all the time! Tables, columns get renamed occasionally... Tables, columns can disappear(!) Multiple releases will be in play simultaneously in the future
Sierra Views ‘Behind the Curtain”
Internal Tool: LookingGlass
LookingGlass: View management
LookingGlass: View Documentation
LookingGlass: Documentation Detail
SierrraDNA: Details
SierraDNA: Entity-Relationship Diagrams
PgAdminIII
Working out the SQL
iReport Example
.pdf Result
View Configuration and Support Versioning Security Dedicated direct SQL access ‘role’ Dedicated accounts setup via the Admin App Access control via Postgres configuration and firewall
Dev partners’ SQL Views webinar: View Links SierraDNA http://techdocs.iii.com/sierradna/ Dev partners’ SQL Views webinar: http://csdirect.iii.com/beta/sierra/videos/index.shtml
Sierra APIs Sierra Phase 1: Architectural Review Sierra Phase 2: RESTful Services
Sierra Phase 1: Architectural Components Review -- Postgre Database -- Services Layer -- SQL Access Encapsulate database – Consistent business rules
Dashboard OpenSocial container. Allows you to plug in gadgets.
Sierra Phase 1: Architectural Components Took it one step further. Dashboard.
REST Endpoint Already had a data access layer Tightly coupled, fine grained Loosely coupled, course grained
WebCirc and beyond As we build gadgets, applications such as WebCirc, RESTservices are create. Sierra Partners can leverage those same APIs in their apps.
RESTful Services What is REST? Authentication Versioning Support We will be using these same business services
What is REST? Architectural style Based on http, used by browsers http://mylib.org/bib/b100123/holds.html Understood by machines Resources (nouns) Methods (verbs) Format
URL for everything a machine needs to talk about Nouns for machines Resources URL for everything a machine needs to talk about Nouns for machines Examples http://mylib.org/bib/b100123/holds (list of holds) http://mylib.org/bib/b100123/holds/hold2 (hold2 in list of holds)
Methods (REST is CRUD) POST Create a resource GET Read a resource PUT Update a resource DELETE Delete a resource
Format XML JSON /bib/b100123/holds.xml /bib/b100123/holds&format=xml /bib/b100123/holds.json /bib/b100123/holds&format=json
XML Response Example <bib> <record_key>b100123</record_key> <holds count="2"> <hold> <hold_key>hold4</hold_key> <record_key>p01000011</record_key> … <links><link rel="self" href="http://mylib.org/sierra/ws/rest/v1/bib/b100123/holds/hold4"/></links> </hold> <hold_key>hold27</hold_key> <record_key>p01000012</record_key> <links><link rel="self” href="http://mylib.org/sierra/ws/rest/v1/bib/b100123/holds/hold27"/></links> </holds> <links><link rel="self" href="http://mylib.org/sierra/ws/v1/bib/b100123/holds"/></links> </bib>
JSON response example { "record_key" : "b100123", "holds" : { "count" : 2, "list" : [ { "hold_key" : "hold4", "record_key" : "p01000011", ... "links" : [ { "href" : "http://mylib.org/sierra/ws/rest/v1/bib/b100123/holds/hold4", "rel" : "self" } ], }, { "hold_key" : "hold27", "record_key" : "p01000012", "links" : [ { "href" : "http://mylib.org/sierra/ws/rest/v1/bib/b100123/holds/hold27", "rel" : "self" } ], } ] }, "links" : [ { "href" : "http://mylib.org/sierra/ws/rest/v1/bib/b01000009/holds", "rel" : "self" } ] }
Add one hold to a list of holds Get all holds on bib Update all holds* CRUD holds Add one hold to a list of holds POST /bib/b100123/holds Get all holds on bib GET /bib/b100123/holds Update all holds* PUT /bib/b100123/holds Delete all holds DELETE /bib/b100123/holds
Create something on a hold* Get one hold Update one hold CRUD one hold Create something on a hold* POST /bib/b100123/holds/hold2 Get one hold GET /bib/b100123/holds/hold2 Update one hold PUT /bib/b100123/holds/hold2 Delete one hold DELETE /bib/b100123/holds/hold2
Authentication with OAuth2 Oauth is an open authentication protocol Ability to run a rest service granted to a User using Auth/Auth Token is like a temporary library card Diff between OAuth1 and Oauth2 is SSL for return of the token and subsequent request
Add /v1 to the beginning of every request In the future, we’ll add /v2 Versioning Add /v1 to the beginning of every request /v1/bib/b100123/holds In the future, we’ll add /v2 /v2/bib/b100123/holds Later, end of life all of /v1
We use the APIs to build Sierra Automatically exposed Documentation Support We use the APIs to build Sierra Automatically exposed Documentation Deployment Developer Keys Eat our own dog food
Which APIs? And When? Patron Facing: Place & Cancel Holds, Renew Items WebCirc: Check Out, Check In Item Availability Set Item Status Create Orders Create Pull Slips Tell Us!
Questions?
Thank You!