Skip to content
KARABO MOTSEPE

APIs

REST API Integration Patterns

By Karabo Motsepe · · 3 min read

REST APIs make it relatively easy for two applications to exchange data. Enterprise integration, however, requires more than knowing how to send GET and POST requests.

A production integration needs a pattern that matches the business process.

Pattern 1: Synchronous request-response

System A
   |
   | Request
   v
System B
   |
   | Response
   v
System A

This works well when response time is short and the caller needs the result immediately.

It is less suitable when downstream processing takes minutes or hours.

Pattern 2: Asynchronous submission

For long-running work, an API may accept the request and return an identifier.

System A
   |
   | POST application
   v
System B
   |
   | 202 Accepted
   | application_id = 789
   v
System A

System A stores the external ID. Completion can later be detected by polling or webhook.

This is common in KYC, document processing and eSignature workflows.

Pattern 3: Polling

Polling repeatedly checks the target state.

Every 15 minutes
      |
      v
GET /applications/789
      |
      +--> pending
      |
      +--> complete

Polling is useful when webhooks are unavailable, but frequency should be chosen carefully to avoid unnecessary API traffic.

Pattern 4: Webhook callback

With a webhook, the target notifies the consumer when something changes.

System A --> Create request --> System B

Later:

System B --> Webhook --> System A

Webhook consumers must handle authentication, duplicates, retries and potentially out-of-order events.

Pattern 5: Webhook plus status API

A particularly robust pattern is:

Webhook
   |
   v
Extract resource ID
   |
   v
GET authoritative resource
   |
   v
Process latest state

The webhook acts as the notification while the REST API remains the source of truth.

Pattern 6: Upsert

An upsert means update if the record exists, otherwise create it.

This is useful for synchronisation but depends on a stable business key such as employee number, supplier code or external contract ID.

Pattern 7: Idempotent create

Some POST requests risk creating duplicates. A safer design uses an idempotency key or a business reference that can be checked before creating another resource.

Retries should not accidentally duplicate the business transaction.

Pattern 8: Pagination

List endpoints frequently return data in pages.

{
  "page": 1,
  "page_size": 50,
  "record_count": 250
}

A correct integration must continue requesting pages until all required records are retrieved.

Common pagination styles include page number, offset/limit, cursor and next URL.

Pattern 9: Incremental synchronisation

Instead of retrieving every record during every run, request only records changed since the previous successful checkpoint.

This reduces API traffic and processing cost.

Pay careful attention to timestamps, time zones and what happens when a batch partially fails.

Pattern 10: API gateway mediation

Rather than allowing every system to communicate directly with every API, an API gateway can provide authentication, routing, rate limiting, analytics and central policy enforcement.

The integration layer can then focus on transformation and orchestration.

Error handling

Interpret HTTP status codes intentionally.

  • 2xx: success
  • 400: bad request or validation issue
  • 401: authentication problem
  • 403: permission problem
  • 404: resource not found
  • 409: conflict
  • 429: rate limit
  • 5xx: server-side failure

Do not retry every error identically.

Retry patterns

Retries are useful for transient failures such as timeouts and temporary server errors.

Use backoff rather than sending the same request repeatedly with no delay.

API versioning

A production integration should know which API version it uses and track deprecation notices.

Do not assume an endpoint will remain unchanged forever simply because it works today.

Contract-first thinking

A good API integration has a clear technical contract covering endpoint, method, authentication, request schema, response schema, error schema, rate limits, pagination and timeout behaviour.

OpenAPI or Swagger documentation is extremely useful, but real implementation testing remains essential.

Final thoughts

Enterprise REST integration is not about choosing the most sophisticated pattern. It is about choosing the simplest pattern that remains reliable under real operating conditions.

The business process should determine the integration pattern, not the other way around.