Representational State Transfer

REST is a paradigma for data transfer between client and server. It’s using the verbs GET, POST, PUT, DELETE (and some others) from the HTTP-protokoll,
hence there is almost everywhere a solid infrastructure. For Machine-2-Machine communication REST is a smart choice.

REST deals with resources uniquely identified by URL’s. For Example: could be a user ressource with 5 as an user id. By requesting this resource via different types of HTTP verbs typical CRUD (create, read, update, delete) actions can be performed on the ressource.

I will show some very simple ways how to get startet with REST.

Imagine you would call a REST service with curl from the commandline like this (thats a GET request):

curl ''

or with a POST request:

curl --data 'firstname=max&lastname=miller' ''

The responding server-side could look somewhat like this.
We deal here with pseude-code. Depending on the framework you use, it differs how to access parameters passed alongside the request.

switch ($method) {
  case 'GET':
    // fetching the user by the id and return it
  case 'PUT':
    // create a new user and return it
  case 'POST':
    // alter a user by its id
  case 'DELETE':
     // delete the user by its id ...