What is a REST API?

A REST API allows a user to interact with the server by creating requests and receiving responses. REST stands for REpresentational State Transfer and API stands for Application Programming Interface. A REST API is a type of API that follows a REST architecture.

There are six architectural constraints that all REST APIs follow:

  1. Client-Server Architecture- this indicates that the client and the server are separate from each other and must be able to function independently.

  2. Uniform Interface- the structure of the call and response must be uniform across all REST APIs.

  3. Stateless- This means the server will not store a history of previous calls made to the server. Each call will be considered new.

  4. Cacheable- all responses must be cacheable.

  5. Layered System- It is possible to have many servers. The client should not be able to tell if it is connected to the end server or an intermediary server.

  6. Code on demand (optional)- the server may return executable code to the client.

These constraints are intended to make the REST API fast and reliable.


Definition:
A client is defined by the Merriam Webster dictionary as a computer in a network that uses the services (such as access to files or shared peripherals) provided by a server.

How does the REST API interact with FME Server?

The REST API acts like a intermediary directly communicating with FME Server and relaying the responses back to the client. You can see the relationship between FME Server and the API in the diagram below:

Diagram of the relationship between FME Server and the client

The REST API reads the call which is composed of the HTTP Method, URL, and the body of the call. FME Server will respond with JSON.


Definition:
JSON is a common data interchange format that has become one of the leading choices for supporting web sites and mobile device applications. For more information see the Tutorial: Getting Started with JSON article on the Knowledge Center

What is the purpose of a REST API?

The REST API allows a user to interact with FME Server without the use of the FME Server Graphical User Interface. This enables the user to create web applications that allow a client access to FME Server without ever having to log in or directly access the server. It can also be used to automate processes within FME Server. For instance, an FME user can create a script to run health checks regularly on their FME Server.


Ricky RESTless says...
I use the FME Server REST API for everything! From sending notifications to running jobs and viewing job history. It seems like the possibilities of the FME Server REST API are endless.

Examples of web applications created with the REST API

REST API in Action:

Wexford Councils Planning Portal allows the user to draw a polygon of an area, then the user will set the parameters for the call, in this case their name and email address. The user hits request data and will receive a Report file with the planning applications within the requested area of interest. The request is made to FME Servers REST API when the user clicks on the Re

Wexford Planning Portal Image of Wexford County Council Planning Portal

Server Apps are API calls:

The example below demonstrates how to gather data from FME Server using a web application. It allows a user to request public transit information within an area specified by the user and you can view this Live Online demo.

Data Distribution App Image of an FME Server App utilising the FME REST API

Calling Multiple APIs:

The example below demonstrates how multiple APIs can be called within an application. In this example the application calls the FME Server API with the user selected variables which in turn within the FME Workspace creating the output report calls the UK Environment Agency API to find flood events.

Inspire Flood App Image of an application calling multiple APIs

If you are curious about all the possibilities of using the REST API, please visit the FME Server Playground. The FME Knowledge Center has live demonstrations that display the vast capabilities of using FME Server and the REST API.