Service Paths & Query By Example (QBE): Query Mechanism SIF 3 Service Paths & QBE Service Paths & Query By Example (QBE): Query Mechanism Joerg Huber
Service Paths What is a Service Path? Base URL Format & Components Other URL Components Limitations How do the Frameworks work with Service Paths? Consumer Provider Training Course SIF3: Service Paths January 19
What is a Service Path It is a Query Mechanism! Allows retrieval of ‘Associated’ Objects (i.e. All Students at a School) Standard REST paradigm Optimises data retrieval One query vs. many queries Standard notation, easy to read Query condition is part of the URL. Training Course SIF3: Service Paths January 19
Base URL Format & Components Example: Get Students at School <baseURL>/SchoolInfos/<refId>/StudentPersonals Association Object RefId of the School Object to be returned Query Condition: ‘where SchoolInfoRefId = <refid>’ Training Course SIF3: Service Paths January 19
Other URL Components etc. Service Paths support all standard URL components of any Object Service: Can be ‘nested’ …/SchoolInfos/<refId>/StudentPersonals/<refId>/DailyAttendances Above will return daily attendances for a given student at a given school. Matrix Parameters (zoneId, contexId) Query Parameters (navigationPage, navigationPageSize) HTTP Headers (requestId) Exception: serviceType = SERVICEPATH No Payload Not valid for HTTP GET! Training Course SIF3: Service Paths January 19
Limitations: Query Only Can only Query Data (HTTP GET). No create, update or delete No Events are sent to a Service Path Only available right in ACL will be “QUERY” HTTP Header ‘serviceType’ must be set to ‘SERVICEPATH’ Not to worry about if frameworks are used. Training Course SIF3: Service Paths January 19
Frameworks & Service Paths Currently only available in Java version Consumer: Part of Abstract Consumer consumer.retrieveByServicePath(…) Provider: Implement QueryProvider Interface Direct Environment Template Entry <service name="SchoolInfos/{}/StudentPersonals" type="SERVICEPATH"> <rights> <right type="QUERY">APPROVED</right> </rights> </service> Implemented by class of “Object to be Returned” Training Course SIF3: Service Paths January 19
What is Query By Example It is a Query Mechanism! Allows retrieval of Objects based on a ‘Sample Object’. Service of “Sample Object” serves the query. Query Condition is given by a standard SIF Object: <StudentPersonal> <PersonInfo> <Name Type="LGL"> <FamilyName>Jones</FamilyName> </Name> </StudentPersonal> => Give me all students with legal family name of Jones. Training Course SIF3: Service Paths January 19
URL Components, GET vs. POST. QBE supports all standard URL components of any Object Service: Matrix Parameters (zoneId, contexId) Query Parameters (navigationPage, navigationPageSize) HTTP Headers (requestId, generatorID etc.) BUT it has a Payload!! Not valid for HTTP GET! It uses a HTTP POST with HTTP Header of methodOverride=GET => Abstracted with SIF3 Frameworks. Training Course SIF3: Service Paths January 19
Frameworks & Service Paths Available in Java & .Net version Consumer: Part of Abstract Consumer consumer.retrieveByQBE(…) Provider: Implement QueryProvider Interface If not supported then throw UnsupportedQueryException. ACL: Direct Environment Template Entry Part of standard Object Service (no changes) “QUERY” right must be “APPROVED”. <rights> <right type="QUERY">APPROVED</right> </rights> Training Course SIF3: Service Paths January 19
Question Time… Questions? Training Course SIF3: Service Paths January 19