1 of 16

RESTful APIs, OData, Microservices

Web Technology

Subin Sahayam, Rourab Paul Assistant Professor,

Department of Computer Science and Engineering

Shiv Nadar University

2 of 16

REST Web Service

  • REST Web Service?
    • Provide Information over Web - Interoperability
    • REpresentational State Transfer (REST)
    • Architectural Style
    • More Like Best Practices

K1

3 of 16

RESTful APIs – Principles

  1. Client – Server Separation
  2. Stateless
  3. Cacheable
  4. Layered System
  5. Uniform Interface
  6. Code on demand

K1

4 of 16

RESTful APIs – Principles

REST = architectural style

RESTful = implemented according to REST principles

K2

5 of 16

RESTful APIs – Principles

  1. Client – Server Separation – Client should know only URI
  2. Stateless - Each request is self-contained – Do not remember past request
  3. Cacheable – Clients/Servers can cache and reuse data – Give Option for Cache
  4. Layered System - Intermediaries like proxies or load balancers – Server 1, 2, 3
  5. Uniform Interface - Standard Methods
    • Resource Identification – Unique URI
    • Resource Manipulation through Representations – JSON, XML
    • Hypermedia as the Engine of Application State (HATEOAS)
  6. Code on demand – Server Send Executable Code . Eg: Widget UI Code

K2

6 of 16

RESTful API

K2

7 of 16

REST Web Service vs RESTful API

K1

Aspect

REST services (loose)

RESTful API (strict)

Adherence

Applies some REST ideas, not all constraints.

Implements all REST constraints end‑to‑end.

URI style

May mix verbs or RPC-like endpoints.

Noun‑based resource URIs.

Method semantics

May not fully honor GET/PUT/DELETE/PATCH semantics.

Correct use of methods and status codes.

Caching/ HATEOAS

Optional or inconsistent.

Cache directives and optional hypermedia for discoverability.

Typical use

Quick HTTP APIs where partial REST is acceptable.

Public/microservice APIs needing scalability, interoperability, and clarity.

8 of 16

OData – Open Data Access Protocol

K1

OData (Open Data Protocol) is a standardized protocol for querying and manipulating data over the web.

It is often used to build APIs that allow clients to retrieve data using standardized query options.

  1. OASIS and ISO/IEC Standard
    • REST api Conventions
      • URL pattern
      • Payload Format
      • Meta Data
  2. Flexibility
  3. Query

9 of 16

OData – Open Data Access Protocol

K2

10 of 16

OData Service – Querying

K2

  • /Products?$orderby=Name$desc
  • /Products?$select=Rating,ReleaseDate
  • /Products?$filter=Name$ne$'Chai'
  • /Products?$filter=ID$mod$2$eq$0 

11 of 16

OData Service – Querying

K2

12 of 16

OData Service – Demo

K2

https://services.odata.org/V4/Northwind/Northwind.svc/

https://services.odata.org/V4/Northwind/Northwind.svc/Products

https://services.odata.org/V4/Northwind/Northwind.svc/Products?$top=2

https://services.odata.org/V4/Northwind/Northwind.svc/Products?$filter=UnitPrice%20gt%2050

https://services.odata.org/V4/Northwind/Northwind.svc/Products?$select=ProductName,UnitPrice

https://www.odata.org/getting-started/understand-odata-in-6-steps/?utm_source=chatgpt.com

Understand OData in 6 steps

13 of 16

Monolithic Architecture

K2

14 of 16

Microservices

K2

15 of 16

References

​

​

​

​

​

  1. Evan Hahn, “Express in Action: Writing, Building, and Testing Node.js Applications" – 15 April 2016, First Edition.
  2. Brad Dayley, Brendan Dayley, Caleb Dayley, “Node.js, MongoDB and Angular Web Development: The definitive guide to using the MEAN stack to build web applications”, Pearson Education, Second Edition, 2017.
  3. Greg Lim, “Beginning MERN Stack: Build and Deploy a Full Stack MongoDB, Express, React, Node.js App,” 2021.
  4. SubbuAllamaraju, RESTful Web Services Cookbook, First Edition, O'Reilly, 2010.

​

16 of 16

THANK YOU