Web Service - Representational State Transfer (REST|RESTful) Web services

About

Representational State Transfer (REST) Web services, or “RESTful” Web services describes any simple interface that transmits data over a standardized interface (such as HTTP) without an additional messaging layer, such as SOAP.

There is no client context being stored server side (no Sessions). REST is a stateless.

REST is easier to build and consume than using SOAP-services.

REST provides a set of design rules for creating stateless services that are viewed as resources, or sources of specific information, and can be identified by their unique URIs. A client accesses the resource using the URI, a standardized fixed set of methods, and a representation of the resource is returned. The client is said to transfer state with each new resource representation.

Rest is often the base technology behind micro-services

Concept

Object Address

Objects in a typical REST system are addressable by URI and interacted with using verbs in the HTTP protocol.

  • An HTTP GET to a particular URI fetches an object and returns a server-specified set of fields.
  • An HTTP PUT edits an object;
  • An HTTP DELETE deletes an object; and so on.

Because of multiple round-trips and over-fetching, applications built in the REST style inevitably end up building ad hoc endpoints.

Ad Hoc Endpoints

Many applications have no formalized client-server contract. Product developers access server capabilities through ad hoc endpoints and write custom code to fetch the data they need. (They end up with a custom endpoint per view).

HTTP Request Method

REST makes use of the HTTP request methods:

  • GET - Read requests
  • PUT- Modify Request
  • POST- Create Request
  • DELETE - Delete Request

When you see an application making PUT or GET requests over HTTP or HTTPS, that’s REST.

Context and security

A RESTful interface does not store any information about a particular user's session.

Every request authentication is basic. See Http - Authorization Header (authentication entries)

Version

version can be specified:

  • in the url
  • or as a query string. example: api-version: 2015-06-15

Schema

There is actually two schema file format that may defines your Rest API:

Development

Contract first

In a contract first / contract-driven development:

  • the schema file is defined first.
  • boilerplate code (ie POJOs) is generated from it
  • client / documentation (known as console) is generated from it
  • and /or every request can be also be controlled from it

Disadvantage:

  • the schema file must be kept up-to-date.
  • once generated, you can't regenerate the boilerplate code
  • not really flexible

Code First

In a code first development:

  • the code is annotated with annotation or comment
  • a schema file can then be generated (Example: from jax-rs swagger-core)
  • client / documentation (known as console) can be generated from:

Documentation generator:

Language

Java

see Java - Rest

Php

Server:

dispatcher:

Javascript

Client:

Test:

Test

Mock

Via the setting of a proxy, you can set up what's called a mock-server

Container

Test in container. See test-suite with Blog

List of Known Public API

Documentation / Reference





Discover More
Card Puncher Data Processing
AWS - Api Gateway

With Amazon API Gateway, you can create a RESTful API that will expose an HTTP endpoint that can be invoked from your users' browsers. You'll then connect the Lambda function to this endpoint
Yarn Hortonworks
HDFS - WebHDFS (Rest API )

WebHDFS is a rest api for the HDFS file system Example: A Web URL provides an Upload end-point into a designated HDFS folder. where: the port 30070 is the port of the namenode ui ...
Java Conceptuel Diagram
Java - Rest

in Java Jax Rs is an annotated Rest specification jersey is the most well known implementation When testing a Rest API (ie when writing a unit test), there is two approach: you create...
Javascript - Template

in javascript From a non-HTML to an HTML format HTML HTML as template engine with fragment on the server (Rest based)...
Card Puncher Data Processing
Language - Binding (IPC)

Binding / Talking method between language. Generally, service communication uses a REST approach with HTTP and TCP protocols and XML or JSON as the serialization format. From an interface perspective,...
OpenAPI

is a Rest API specification that defines a file format (in json or yaml) that describes rest APIs From this file, the following can be generated: a server skeleton a client and the documentation...
Process States
Process - Inter Process Communication (IPC)

An Inter Process Communication (IPC) describes the fact that two or more processes exchange information. IPC is used not just for communication between processes on the same system, but also on different...
Card Puncher Data Processing
Spark - Livy (Rest API )

Livy is an open source REST interface for interacting with Spark from anywhere. It supports executing: snippets of code or programs in a Spark Context that runs locally or in YARN. It's used...
Testing Infrastructure
Test - Integration

integration test are test that runs between different services of a system. If you are building a website, the test script will start your website and use a headless browser to test automatically...
Testing Infrastructure
Test - Mock

Mocking is just replacing or wrapping a function by another function at runtime called a mocking function. Example: This function overrule the actual implementation of a function during a test. It permits...



Share this page:
Follow us:
Task Runner