Overview of Web Services

One of the first things people encounter when working with web services is a word salad of terms, acronyms and terminology much of it seeming to say the same thing! To clarify we discuss below some of the most common terms.

Web services have risen to prominence as the internet and world wide web have moved computing from something that happens on a single desktop machine to a global interconnected web of services and consumers. As life moves increasingly online people interact with web services all from choosing what to watch on Netflix to ordering dinner from their phone without ever realising.

A web service allows a user to get information from a remote server based on either a simple request or on a specific set of criteria that a user requests.

For example if you want to order dinner you may use an app on your phone which would make a request to a web service asking for the available restaurants near your current location. The web service would reply with a list of all of the available restaurants and the app would display this. The app may allow the user to make specific choices about the type of restaurant which would be based to the remote server for it to filter the information it returns to the app.

What is a Web Service?

A web service is typically a service offered by an electronic device to another electronic device communicating with each other via the internet. The communication is most commonly carried out via HTTP and transfers machine readable file formats such as XML, JSON or JPEG and PNG.

The Wexford Planning Portal for example uses a number of web services, including the map backgrounds, the search tool and the data request submission.

Wexford Planning Portal

What is an API (Application Programming Interface)?

The term web service describes the high level interaction, and the Application Programming Interface or API is used to describe the particular interfaces used by a web service. Often a web service will have many different APIs supporting different parts of the functionality it offers.

API's come in different types based on the platform they are being used on, the most common type for web services are REST APIs though for legacy systems the older SOAP based services can be found. Both support requests over the HTTP protocol and the key difference between them is how the services respond and how you ask them for information.

A major criticism of non-RESTful web services is that they are far too complex, proprietary and are less performant. For this reason they have fallen out of favour and have been replaced by APIs following the REST specification.

An example request to the OSI MapGenie web service from the Wexford Portal would look like the example below. The API defines the structure of the request and the parameters required to complete it successfully. In this instance it defines the URL structure to determine the map layer and location of the returned map image and the API also requires that a parameter named token is included to authenticate the request.

API

You may also hear them referred to as a service endpoint especially when describing the boundary between external consumers and the internal system. A endpoint is just a way of describing and differentiating an API that a third party interacts with.

What is a REST API?

A REST API is a particular type of software architectural style used for an API and is the most common type of web service API for modern services and applications. REST stands for Representational State Transfer and it is a set of rules for developers to follow in creating an API.

RESTful APIs will use standard HTTP methods such as GET,POST,PUT and Delete to carry out their operations, and will have a base URI. In the MapGenie example above the base URI was https://mapgenie.osi.ie/arcgis/rest and it used a HTTP Get method to make the request.

The example below shows a typical request for data from a client application. The client calls the API using a GET or POST request, the system providing the API parses this request, retrieves the data from the database and returns it to the client as JSON or XML.

REST API

What are Microservices?

As web services have grown its lead to an increase in the complexity of the systems managing and delivering these. Microservice architectures have become popular to modularise these big systems and break them down into small components that have a well defined API. A system built using microservices will have many components that each talk to each other via APIs allowing a components technology or coding to be replaced as long as its replacement follows the same API specification.

As microservices are more of a system design pattern built on the components above.