SlideShare a Scribd company logo
Sumit Amar
@ChiefCoder
October 28, 2020
apidays LIVE LONDON - Data Retrieval via APIs - Showdown of GraphQL vs ODATA by Sumit Amar
• Be REST Assured (RESTfulness)
• HATEOAS
• ODATA for Data Retrieval
• Webhooks / Callbacks
• Comparing GraphQL
• Resources / Entities Depiction
• HTTPVerb Usage
• Entity Relationships
• Status Codes
• Idempotency
• Pluralized nouns for entities
/users
• Actions using HTTP methods
GET /users
• Instances vs Collections
GET /users (returns a collection)
GET /users/1a (returns an instance)
• GET : Retrieve an instance or collection.
• POST : Creates an entity record.
• PUT : Updates a wholesome entity given its
ID.
• DELETE: Removes an entity given its ID
• PATCH: Partially updates an entity given its ID
• OPTIONS: Returns list of HTTP methods
available for an entity
• POST /players
{
"name":"A B",
"country_code":"US",
"phone":"000 000 0000"
}
Response 201 Created
{
"id":"1a",
"name":"A B",
"country_code":"US",
"phone":"000 000 0000"
}
• POST /players/1a/trophies
{
"game":"Mario",
"trophy_name":"Champion"
}
Response: 201 Created
{
"id":"1t",
"game":"Mario",
"trophy_name":"Champion"
}
• GET /players/1a
{
”id":”1a",
"name":"A B",
"country_code":"US",
"phone":"000 000 0000",
"trophies":[
{
"id":"1t",
"game":"Mario",
"trophy_name":"Champion"
},
{
"id":"2t",
"game":"Contra",
"trophy_name":"Champion"
}
]
}
200 OK – ResponseOK. Should be used in GET (or PUT calls containing modified entity)
201 Created – Returned by a synchronous POST call creates an entity.
202 Accepted – Result of an long running operation by a POST call.
204 No Content – Result of a synchronous operation by a DELETE or PUT/PATCH
304 Not Modified – A cached response is returned
400 Bad Request – A malformed JSON request is sent
401 Unauthorized – API user is not authenticated. Bad credentials.
403 Forbidden – API user is not authorized. User roles don’t allow invoking an endpoint
409 Conflict – A race condition is found (validation of updated/modified timestamp
failed)
404 Not Found – Record for provided ID is not found, in case of GET, DELETE, PUT,
PATCH
408 RequestTimeout – Server couldn’t process the request in a specified time limit
414 URIToo Long – When the URL length limit of 2083 is hit
429Too Many Requests –Throttled API response, as a result of rate-limiting feature
500 Internal Server Error
501 Not Implemented – A requested method/operation is not implemented by service
503 Service Unavailable (with details if in debug mode) - In case of service based errors
• Repeated calls to the same resource must
recreate entities
• E.g. Repeatedly calling PUT /players/1a should
just update the record
• PATCH special case
• HypermediaAsThe Engine Of Application
State
• Sticky links in API responses
• Includes schema details
• Provides navigational elements (links) to
entities used in an API response
• {
"links":[
{
"href":"<baseURL>/players/1a",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":{
"id":"1a",
"name":"A B",
"country_code":"US",
"game_id":"1g"
}
}
• Open Data Framework (odata.org)
• Standard, predictable method to query
• SQL-like syntax in HTTP URLs
• Works atop RESTful GET endpoints
• Reduces cognitive dissonance in developers
• Server and client side libraries exist (Olingo for
Java,ASP.NET in .NET, and others)
• $select - Filter the list of attributes from an instance (SELECT)
• $filter - Expressions to filter list of records from a collection
(WHERE)
• $top - Number of records to retrieve (FETCH orTOP or LIMIT)
• $offset - Skip to this record number (OFFSET)
• $expand - Expand body of an aggregation/reference entity
(similar to adding a JOIN)
• $orderby - Sort the collections based on given column
name(s) (ORDER BY)
• $count - Return only the count of records in case of a
collections call. (COUNT)
• $select - Filter the list of attributes from an instance (SELECT)]
GET /players?$select=name
{
"links":[
{
"href":"<baseURL>/players?$select=name",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":[
{
"name":"A B"
}
]
}
• Filter the list of attributes from an instance (SELECT)]
query {
players {
name
}
}
{
"data":{
"players ” : [ {
"name":"A B"
}
]
}
• $filter - Expressions to filter list of records from a collection (WHERE)
GET /players?$filter=name eq ‘A B’&$select=id,name
{
"links":[
{
"href":"<baseURL>/players?$filter=name eq ‘A B’&$select=id,name ",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":[
{
"id":"1a",
"name":"A B"
}
]
}
• Expressions to filter list of records from a collection (WHERE)
query {
players(filter:{ name : {eq : “A B”}}) {
id,
name
}
}
query {
player(id:”1a”) {
id,
name
}
}
{
"data":{
"players ” : [ {
"id":"1a",
"name":"A B"
}
]
}
{
"data":{
"player” : {
"id":"1a",
"name":"A B"
}
}
• $top - Number of records to retrieve (FETCH orTOP or LIMIT)
• $offset - Skip to this record number (OFFSET)
• GET /players?$top=1&$offset=2 (Skips two records and takes 1)
{
"links":[
{
"href":"<baseURL> /players?$top=1&$offset=2",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":[
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game_id":"1g"
}
]
}
• first - Number of records to retrieve (FETCH orTOP or LIMIT)
• offset - Skip to this record number (OFFSET)
query {
players(first:1 offset:2)
{
id,
name,
country_code,
game_id
}
}
{
"data": {
"players": [
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game_id":"1g"
}
]
}
}
• $expand - Expand body of an aggregation/reference entity (similar to adding a JOIN)
• GET /players/1a?$expand=game
{
"links":[
{
"href":"<baseURL>/players/1a?$expand=game",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game":{
"id":"1g",
"name":"Contra"
}
}
}
• Expand body of an aggregation/reference entity (similar to adding a JOIN)
query {
player(id:”1a”)
{
id,
name,
country_code,
game {
id,
name
}
}
}
{
"data": {
"player":
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game":{
"id":"1g",
"name":"Contra"
}
}
}
}
• $orderby – sort an entity result using one or more fields
• GET /players?$orderby=name
{
"links":[
{
"href":"<baseURL>/players?$orderby=name ",
"schema":"<baseURL>/schemas/$players",
"rel":"players | self"
},
{
"href":"<baseURL>/games/1g",
"schema":"<baseURL>/schemas/$games",
"rel":"games"
}
],
"data":[
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game_id":"1g"
}
}
]
}
• Sort using order by clause
query {
players(orderby: {name : asc})
{
id,
name,
country_code,
game_id
}
}
{
"data": {
"players": [
{
"id":"1a",
"name":"A B",
"country_code":"US",
"game_id":"1g"
}
]
}
}
• Consider this in C#:
players.Any(p => p.address.city ==
"Foster City" &&
p.validateTrophies()).ToList<Player>();
• To Lambda expression in ODATA
/players?$filter=players/any(p:p/address/
city eq 'Foster City' and
p.validateTrophies())
{
"event" : "player.created",
"for": "<userId>",
"state": "active | inactive",
"description" : "webhook to receive details ",
"callback" : {
"url" : "https://clienturi/statusupdater",
"symkey" : ”a shared secret",
"access-token": "some access token for inbound auth",
"retries" : 5
}
}
• Use RESTful standards
• Use ODATA for predictable retrieval
• Use appropriate status codes
• Make sure to account for
idempotency and concurrency
• Quick comparison of ODATA and
GraphQL

More Related Content

PPTX
Api design and usability
ODP
Terms of endearment - the ElasticSearch Query DSL explained
PDF
Distributed percolator in elasticsearch
PDF
Using Apache Solr
PDF
ElasticES-Hadoop: Bridging the world of Hadoop and Elasticsearch
PDF
Elasticsearch first-steps
PDF
elasticsearch - advanced features in practice
PDF
Elasticsearch speed is key
Api design and usability
Terms of endearment - the ElasticSearch Query DSL explained
Distributed percolator in elasticsearch
Using Apache Solr
ElasticES-Hadoop: Bridging the world of Hadoop and Elasticsearch
Elasticsearch first-steps
elasticsearch - advanced features in practice
Elasticsearch speed is key

What's hot (20)

PDF
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
PDF
Fun with Python
PDF
Elastic search integration with hadoop leveragebigdata
PDF
Elasticsearch in 15 minutes
KEY
Elasticsearch & "PeopleSearch"
PDF
Great+Seo+Cheatsheet
PDF
Drilling Cyber Security Data With Apache Drill
PDF
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
PDF
NoSQL & MongoDB
PPTX
Introduction to Lucene & Solr and Usecases
PDF
Hypermedia In Practice - FamilySearch Developers Conference 2014
PDF
Scaling Recommendations, Semantic Search, & Data Analytics with solr
PPTX
Hive commands
PDF
GraphQL & Relay - 串起前後端世界的橋樑
PPTX
Isomorphic react in real life
PDF
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
PPT
Boosting Documents in Solr by Recency, Popularity, and User Preferences
PDF
What's New in Solr 3.x / 4.0
PDF
HTTP requests
PDF
Hd insight programming
Full-Text Search Explained - Philipp Krenn - Codemotion Rome 2017
Fun with Python
Elastic search integration with hadoop leveragebigdata
Elasticsearch in 15 minutes
Elasticsearch & "PeopleSearch"
Great+Seo+Cheatsheet
Drilling Cyber Security Data With Apache Drill
Tutorial, Part 3: SharePoint 101: Jump-Starting the Developer by Rob Windsor ...
NoSQL & MongoDB
Introduction to Lucene & Solr and Usecases
Hypermedia In Practice - FamilySearch Developers Conference 2014
Scaling Recommendations, Semantic Search, & Data Analytics with solr
Hive commands
GraphQL & Relay - 串起前後端世界的橋樑
Isomorphic react in real life
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Boosting Documents in Solr by Recency, Popularity, and User Preferences
What's New in Solr 3.x / 4.0
HTTP requests
Hd insight programming
Ad

Similar to apidays LIVE LONDON - Data Retrieval via APIs - Showdown of GraphQL vs ODATA by Sumit Amar (20)

PPTX
Data Access Options in SharePoint 2010
PPT
RESTful JSON web databases
PPTX
PPTX
Rest with Java EE 6 , Security , Backbone.js
PDF
ApacheCon 2005
ODP
RestFull Webservices with JAX-RS
PPTX
Elegant Rest Design Webinar
PPTX
Spring Boot and REST API
PDF
JAX-RS JavaOne Hyderabad, India 2011
PPTX
PDF
SAP ODATA Overview & Guidelines
PDF
L12: REST Service
PPTX
[SharePoint Korea Conference 2013 / 강율구] Sharepoint 스마트하게 개발하기
PDF
03 form-data
PPTX
Are you getting Sleepy. REST in SharePoint Apps
PDF
ERRest - Designing a good REST service
PDF
RESTful Web services using JAX-RS
PDF
Jersey
PDF
Alfresco tech talk live public api episode 64
PDF
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Data Access Options in SharePoint 2010
RESTful JSON web databases
Rest with Java EE 6 , Security , Backbone.js
ApacheCon 2005
RestFull Webservices with JAX-RS
Elegant Rest Design Webinar
Spring Boot and REST API
JAX-RS JavaOne Hyderabad, India 2011
SAP ODATA Overview & Guidelines
L12: REST Service
[SharePoint Korea Conference 2013 / 강율구] Sharepoint 스마트하게 개발하기
03 form-data
Are you getting Sleepy. REST in SharePoint Apps
ERRest - Designing a good REST service
RESTful Web services using JAX-RS
Jersey
Alfresco tech talk live public api episode 64
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Ad

More from apidays (20)

PDF
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
PDF
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
PDF
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
PDF
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
PDF
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
PDF
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
PDF
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
PDF
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
PPTX
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
PPTX
apidays Munich 2025 - Effectively incorporating API Security into the overall...
PPTX
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
PPTX
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
PPTX
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
PPTX
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
PPTX
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
PDF
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
PDF
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
PDF
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
PDF
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays Munich 2025 - Integrate Your APIs into the New AI Marketplace, Senthi...
apidays Munich 2025 - The Double Life of the API Product Manager, Emmanuel Pa...
apidays Munich 2025 - Let’s build, debug and test a magic MCP server in Postm...
apidays Munich 2025 - The life-changing magic of great API docs, Jens Fischer...
apidays Munich 2025 - Automating Operations Without Reinventing the Wheel, Ma...
apidays Munich 2025 - Geospatial Artificial Intelligence (GeoAI) with OGC API...
apidays Munich 2025 - GraphQL 101: I won't REST, until you GraphQL, Surbhi Si...
apidays Munich 2025 - Effectively incorporating API Security into the overall...
apidays Munich 2025 - Federated API Management and Governance, Vince Baker (D...
apidays Munich 2025 - Agentic AI: A Friend or Foe?, Merja Kajava (Aavista Oy)
apidays Munich 2025 - Streamline & Secure LLM Traffic with APISIX AI Gateway ...
apidays Munich 2025 - Building Telco-Aware Apps with Open Gateway APIs, Subhr...
apidays Munich 2025 - Building an AWS Serverless Application with Terraform, ...
apidays Helsinki & North 2025 - REST in Peace? Hunting the Dominant Design fo...
apidays Helsinki & North 2025 - Monetizing AI APIs: The New API Economy, Alla...
apidays Helsinki & North 2025 - How (not) to run a Graphql Stewardship Group,...
apidays Helsinki & North 2025 - APIs in the healthcare sector: hospitals inte...

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Mushroom cultivation and it's methods.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
1. Introduction to Computer Programming.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
TLE Review Electricity (Electricity).pptx
Assigned Numbers - 2025 - Bluetooth® Document
MIND Revenue Release Quarter 2 2025 Press Release
A comparative analysis of optical character recognition models for extracting...
Heart disease approach using modified random forest and particle swarm optimi...
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25-Week II
Mushroom cultivation and it's methods.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Empathic Computing: Creating Shared Understanding
Programs and apps: productivity, graphics, security and other tools
1. Introduction to Computer Programming.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
OMC Textile Division Presentation 2021.pptx
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf

apidays LIVE LONDON - Data Retrieval via APIs - Showdown of GraphQL vs ODATA by Sumit Amar

  • 3. • Be REST Assured (RESTfulness) • HATEOAS • ODATA for Data Retrieval • Webhooks / Callbacks • Comparing GraphQL
  • 4. • Resources / Entities Depiction • HTTPVerb Usage • Entity Relationships • Status Codes • Idempotency
  • 5. • Pluralized nouns for entities /users • Actions using HTTP methods GET /users • Instances vs Collections GET /users (returns a collection) GET /users/1a (returns an instance)
  • 6. • GET : Retrieve an instance or collection. • POST : Creates an entity record. • PUT : Updates a wholesome entity given its ID. • DELETE: Removes an entity given its ID • PATCH: Partially updates an entity given its ID • OPTIONS: Returns list of HTTP methods available for an entity
  • 7. • POST /players { "name":"A B", "country_code":"US", "phone":"000 000 0000" } Response 201 Created { "id":"1a", "name":"A B", "country_code":"US", "phone":"000 000 0000" }
  • 8. • POST /players/1a/trophies { "game":"Mario", "trophy_name":"Champion" } Response: 201 Created { "id":"1t", "game":"Mario", "trophy_name":"Champion" }
  • 9. • GET /players/1a { ”id":”1a", "name":"A B", "country_code":"US", "phone":"000 000 0000", "trophies":[ { "id":"1t", "game":"Mario", "trophy_name":"Champion" }, { "id":"2t", "game":"Contra", "trophy_name":"Champion" } ] }
  • 10. 200 OK – ResponseOK. Should be used in GET (or PUT calls containing modified entity) 201 Created – Returned by a synchronous POST call creates an entity. 202 Accepted – Result of an long running operation by a POST call. 204 No Content – Result of a synchronous operation by a DELETE or PUT/PATCH 304 Not Modified – A cached response is returned 400 Bad Request – A malformed JSON request is sent 401 Unauthorized – API user is not authenticated. Bad credentials. 403 Forbidden – API user is not authorized. User roles don’t allow invoking an endpoint 409 Conflict – A race condition is found (validation of updated/modified timestamp failed) 404 Not Found – Record for provided ID is not found, in case of GET, DELETE, PUT, PATCH 408 RequestTimeout – Server couldn’t process the request in a specified time limit 414 URIToo Long – When the URL length limit of 2083 is hit 429Too Many Requests –Throttled API response, as a result of rate-limiting feature 500 Internal Server Error 501 Not Implemented – A requested method/operation is not implemented by service 503 Service Unavailable (with details if in debug mode) - In case of service based errors
  • 11. • Repeated calls to the same resource must recreate entities • E.g. Repeatedly calling PUT /players/1a should just update the record • PATCH special case
  • 12. • HypermediaAsThe Engine Of Application State • Sticky links in API responses • Includes schema details • Provides navigational elements (links) to entities used in an API response
  • 13. • { "links":[ { "href":"<baseURL>/players/1a", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data":{ "id":"1a", "name":"A B", "country_code":"US", "game_id":"1g" } }
  • 14. • Open Data Framework (odata.org) • Standard, predictable method to query • SQL-like syntax in HTTP URLs • Works atop RESTful GET endpoints • Reduces cognitive dissonance in developers • Server and client side libraries exist (Olingo for Java,ASP.NET in .NET, and others)
  • 15. • $select - Filter the list of attributes from an instance (SELECT) • $filter - Expressions to filter list of records from a collection (WHERE) • $top - Number of records to retrieve (FETCH orTOP or LIMIT) • $offset - Skip to this record number (OFFSET) • $expand - Expand body of an aggregation/reference entity (similar to adding a JOIN) • $orderby - Sort the collections based on given column name(s) (ORDER BY) • $count - Return only the count of records in case of a collections call. (COUNT)
  • 16. • $select - Filter the list of attributes from an instance (SELECT)] GET /players?$select=name { "links":[ { "href":"<baseURL>/players?$select=name", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data":[ { "name":"A B" } ] }
  • 17. • Filter the list of attributes from an instance (SELECT)] query { players { name } } { "data":{ "players ” : [ { "name":"A B" } ] }
  • 18. • $filter - Expressions to filter list of records from a collection (WHERE) GET /players?$filter=name eq ‘A B’&$select=id,name { "links":[ { "href":"<baseURL>/players?$filter=name eq ‘A B’&$select=id,name ", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data":[ { "id":"1a", "name":"A B" } ] }
  • 19. • Expressions to filter list of records from a collection (WHERE) query { players(filter:{ name : {eq : “A B”}}) { id, name } } query { player(id:”1a”) { id, name } } { "data":{ "players ” : [ { "id":"1a", "name":"A B" } ] } { "data":{ "player” : { "id":"1a", "name":"A B" } }
  • 20. • $top - Number of records to retrieve (FETCH orTOP or LIMIT) • $offset - Skip to this record number (OFFSET) • GET /players?$top=1&$offset=2 (Skips two records and takes 1) { "links":[ { "href":"<baseURL> /players?$top=1&$offset=2", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data":[ { "id":"1a", "name":"A B", "country_code":"US", "game_id":"1g" } ] }
  • 21. • first - Number of records to retrieve (FETCH orTOP or LIMIT) • offset - Skip to this record number (OFFSET) query { players(first:1 offset:2) { id, name, country_code, game_id } } { "data": { "players": [ { "id":"1a", "name":"A B", "country_code":"US", "game_id":"1g" } ] } }
  • 22. • $expand - Expand body of an aggregation/reference entity (similar to adding a JOIN) • GET /players/1a?$expand=game { "links":[ { "href":"<baseURL>/players/1a?$expand=game", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data": { "id":"1a", "name":"A B", "country_code":"US", "game":{ "id":"1g", "name":"Contra" } } }
  • 23. • Expand body of an aggregation/reference entity (similar to adding a JOIN) query { player(id:”1a”) { id, name, country_code, game { id, name } } } { "data": { "player": { "id":"1a", "name":"A B", "country_code":"US", "game":{ "id":"1g", "name":"Contra" } } } }
  • 24. • $orderby – sort an entity result using one or more fields • GET /players?$orderby=name { "links":[ { "href":"<baseURL>/players?$orderby=name ", "schema":"<baseURL>/schemas/$players", "rel":"players | self" }, { "href":"<baseURL>/games/1g", "schema":"<baseURL>/schemas/$games", "rel":"games" } ], "data":[ { "id":"1a", "name":"A B", "country_code":"US", "game_id":"1g" } } ] }
  • 25. • Sort using order by clause query { players(orderby: {name : asc}) { id, name, country_code, game_id } } { "data": { "players": [ { "id":"1a", "name":"A B", "country_code":"US", "game_id":"1g" } ] } }
  • 26. • Consider this in C#: players.Any(p => p.address.city == "Foster City" && p.validateTrophies()).ToList<Player>(); • To Lambda expression in ODATA /players?$filter=players/any(p:p/address/ city eq 'Foster City' and p.validateTrophies())
  • 27. { "event" : "player.created", "for": "<userId>", "state": "active | inactive", "description" : "webhook to receive details ", "callback" : { "url" : "https://clienturi/statusupdater", "symkey" : ”a shared secret", "access-token": "some access token for inbound auth", "retries" : 5 } }
  • 28. • Use RESTful standards • Use ODATA for predictable retrieval • Use appropriate status codes • Make sure to account for idempotency and concurrency • Quick comparison of ODATA and GraphQL