You are here:

/

2 December 2019

Data exchange through the REST API

Julien, manager and technical-functional consultant, explains us the REST API mechanism through a concrete case study from our company.

Interface management between applications is one of the major concern when it comes to setting up a business application.

As part of the implementation of their PLM, one of our customers came to us to request import automation for the images from their Digital Asset Management (DAM). Indeed, this manual action represented a heavy workload for the user.

The complexicity of the subject was to find a technical solution that could answer both to our security constraints, easy implementation need and responsive usage. In this context we used the API REST available from both applications (PLM and DAM) in order to import the product images in the PLM.

This integration was a success and a key factor for our customers’ acceptance.

What is a REST API ?

An API or « Application Programming Interface » is an IT solution that allows applications to exchange data & services.

Using a REST API will consist in querying a third-party server using the same methods as those used to display a web page.

The REST API works according to the client-server principle :

• The client will send a request to the server. This request will contain as much information as possible about the query • The server sends back the information in the required format.

For example, the customer can send a request asking for a products’ list in the PLM. The PLM API sends a response (most commonly in JSON format) containing the list and product information.

How does the REST API work?

When using a Rest API, one should have the knowledge of resources and methods:

1. Resources

A resource is an object to which the API user will access. In the case of PLM we find resources such as product, supplier, material, bom… We will use API resources to specify what we need in the business application.

Herebelow some examples of URL construction will allow us to better understand this process :

• To search a list of products : https://myplm/api/product • To search a specific product, the below ID can be added : https://myplm /api/product/3445

It is also possible to interlink data in order to obtain associated resources.

• If we look for product images, we need to add another information : https://myplm /api/product/3445/Images

2. The methods used :

Methods will allow us to specify the type of operation to perform. It will be different depending on the data we want to retrieve, add, edit or delete.

In API Rest, we use the following four methods :

• The GET method – which is the most used – for retrieving data from a ressource • The POST method for send, update, or creation • The PUT methods for updates • The DELETE method for deletion

How does the interface between PLM and DAM work?

The project’s specifications were to retrieve images from the DAM to integrate them in the PLM.

Challenge for this project was twofold :

•  Facilitate the users work by reducing them from a long and tedious operation •  Consolidate media information with a single data source.

To create the interface, we used the respective APIs for the both applications:

•  The DAM API to retrieve the products’ images URLs •  The PLM API to insert images into the FileVault and assign these images to the product.

The diagram below illustrate how it works and connection between interfaces.