Man thinking behind his laptop

Application integration with REST API: these are the 4 pitfalls

REST API is an excellent solution for connecting two or more applications. But sometimes we reach for an API too quickly to exchange data and integrate systems with each other. That is why we have put together a top four of pitfalls for you, so that you can ultimately make a well-considered choice about building a REST API.

1. Forgetting reliability in messaging

What we mean by this is that a request is executed only once (exactly once). Some actions (verbs) of REST API are idempotent, which means that the result of a successful request is independent of the number of times it has been executed. The question is: can a specific backend application avoid duplicates? With an integration layer you then have the option to still create a process that consists of a reliable chain of actions.

Say we have a REST API for archiving documents, but the underlying archive is not very suited to dealing with duplicates. It is then important not to burden the consumer of the API with the shortcomings of the backend application. The consumer should simply be able to resend the message, even if no error was returned. To be able to do that, it is very important that messages are uniquely identifiable. The integration layer is the place to absorb the shortcomings of the backend applications. In the case of the archive solution, all unique message identifiers are stored. If a message arrives at the integration layer for the second time, the archive is first searched to see whether the document already exists. If not, the document is created after all, and the consumer of the API simply gets an HTTP 200 OK back.

2. Building a 'one API fits all'

Create different REST APIs for the needs of a specific user or consumer. It is not unusual to have multiple APIs for one object model. An API between applications communicates in a different (automated) way than an API between an application and an end user. The end user can, for example, decide for themselves what action to take after an error message. Of course an end user does not work directly with an API, but does so via a portal or app.

There is also a difference in rights: you do not want the same information to be available to the end user as with a REST API between applications. For one user an email address is relevant, but not for another. You can leave the same object model at the back end, and only filter data at the front end based on the existing APIs. Do try to avoid building a point-to-point API for every consumer, otherwise the number of REST APIs grows too much.

3. Having no insight into recurring errors

When a request takes very long or goes wrong, as an administrator you want to know where the bottleneck is. By setting up an integration layer, you gain insight into exactly what goes wrong. For example, when creating a customer (via a REST API between applications), you check for duplicates in the integration layer. As an administrator you see the messages that have passed through, but also substantive information about error messages. Also return the errors to an end user, so that they can act on them. Correlate these error messages with those in your management layer, so that you can trace the cause and still complete the action.

4. A REST API is not the solution to every problem

Using REST APIs creates a form of simplification: you assign the responsibilities elsewhere, for example in an integration layer. Sometimes that simplification is fine; you want, for example, to make logging in to a banking application or customer portal as easy as possible for a user. But with batch processing or with events, actions are hard to orchestrate with an API.

Think, for example, of an annual pension statement. That is sent in batches, which works fine with a REST API. But if you build dependencies into it, such as a payout that also requires the bank balance to be adjusted, then this action becomes much more complex. You are then better off reallocating that complexity to an integration layer.

Do you have an integration challenge or a question?

Want to know more about how to define a good REST API and avoid common pitfalls? Then watch our video or get in touch with us. We are happy to help you set up your APIs properly. Our experts are busy at the moment, but you can leave your question here or schedule a time to chat.

Questions about this case?
Get in touch
Portrait of Erwin Beets

Written by
Erwin Beets