Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Generic Communication Protocols

Evaluation

Intro to RESTful API and JSON


Content

● What is REST?
● Basic REST concepts
● AUTOSAR and REST
● HTTP
● JSON
1. What is REST
● REpresentational State Transfer.
● Architecture style for networked systems (not a protocol nor a standard!)
● A set of rules and principles inspired from the web.
● Outlines how resources are defined and addressed.
● Blends very well with HTTP methods (GET, POST, PUT, DELETE).
● Relies on other standards to do its job (HTTP, TLS, JSON, etc…)
● Protocol, language and platform independent which makes it very flexible
● Client-Server architecture just like the web.
● Stateless
● Cacheable
● Uniform Interface (through HTTP methods)
Basic concepts of REST
Resources

● An abstraction of any kind of information.


● Any information that can be named is a resource (document, image, temporary
service, etc…)
● Represented with a global identifier (maps to a URI in HTTP).
○ https://drive.google.com/files/12345
AUTOSAR REST API
● Designed to meet embedded systems constraints(deterministic, low footprint, not too
complicated).
● Modular design to allow better flexibility (OEM can add extra layers on top, vendor-
specific implementations, etc…).
● 3 fundamental abstraction blocks:
○ Object graph to represent the data model.
○ URI
○ Request methods
● Task and asynchronous based model
BASIC COMPONENTS OF ARA::REST
ASPECTS OF HTTP
● Simplicity: HTTP headers can be easily read by Humans
● Extensibility: New features can be added by simple agreement between the client and
the server
● Stateless: No state is kept between different requests(But can be achieved using
cookies)
● Can be used to control authentication, caching and sessions(using cookies).
HTTP Messages

Request Message Response Message


Uniform Resource Locator (URL)
● used to uniquely identify a resource over the web. URL has the following syntax.

protocol://hostname:port/path-and-file-name
There are 4 parts in a URL:
● Protocol: The application-level protocol used by the client and server, e.g., HTTP, FTP, and telnet.
● Hostname: The DNS domain name (e.g., www.nowhere123.com) or IP address (e.g., 192.128.1.2) of the
server.
● Port: The TCP port number that the server is listening for incoming requests from the clients.
● Path-and-file-name: The name and location of the requested resource, under the server document base
directory.
JSON
● JavaScript Object Notation.
● Is used theoretically when software components need to exchange.
● data(regardless of the programming language).
● Mostly used to serialize and transmit data over the network.
● Very Human readable.
● Less verbose and more compact compared to XML.
● Basic types map very well with known programming types.
● Reasonable choice for Embedded use cases due to performance.
● A standard to validate JSON objects called JSON schema.
JSON TYPES
JSON SCHEMA

You might also like