# Async API

# What is an Async API?

API requests can be called synchronously or asynchronously (async). Synchronous requests are executed immediately, while asynchronous requests are processed in the background.

Synchronous requests are made using the loyalty.slrs.io domain, while asynchronous requests are made using the async-api.easypoints.app domain.

# What are the benefits of the Async API?

The Async API will handle and retry all server-side 5xx errors and has a higher throttling limit compared to the synchronous API. This prevents the need for the program to wait to receive a success response from the server before execution can continue.

# Who should use the Async API?

Consider using the Async API to:

  • Avoid handling server-side request errors.
  • Avoid handling throttling errors.

# Who should not use the Async API?

Do not consider using the Async API if:

  • Verifying the success or failure of a request is important. A successful response from the Async API does not indicate successful processing of the request.
  • The request needs to be handled immediately. Async API requests are handled in the background and can take up to 24 hours to process.

WARNING

The Async API will return success responses for incorrect credentials and body parameters. This is because valid arguments are assessed when the request is processed, not when the request is accepted. Please ensure that the credentials and body parameters passed to the Async API are correct.

# Can the Async API fail?

The Async API can still fail due to server-side and client-side errors. Despite the Async API using its own server, it is still possible for this server to be unavailable.

If the request contains incorrect credentials or body parameters it will fail. To ensure correct credentials and body parameters, please test the request using the standard route (the synchronous route).

# Which routes are supported by the Async API?

The Async API currently supports the create allotment route.

# How do I call the Async API?

The only difference between calling synchronous API and Async API routes is the domain. The paths in the Async Api are the same as the synchronous API. To call the Async API use the following domain:

Domain:

async-api.easypoints.app

Request and Response Example:

Here's an example request and successful result:

POST "https://async-api.easypoints.app/api/shopify/point_allotments"

Body {
  "point_value": 200,
  "customer_id": "123"
}
{
    "status": 202
}

A success response from the Async API indicates that the request has been accepted for processing. Note this does not indicate that the request has been successfully processed.