Foundations

Asynchronous Operations

For some Rutter endpoints, a response_mode query parameter is supported. This parameter allows you to specify whether to:

  1. Call the API in a synchronous fashion & wait for the response.
  2. Call the API in an asynchronous fashion, receive a response immediately, and wait for the result. The supported values are prefer_sync and async. By default, prefer_sync is used.

Using the async response mode is recommended when:

  • You want to make idempotent operations, using an Idempotency-Key request header, to avoid creating duplicate requests when sending the same payload.
  • You have specific latency requirements, and do not wish to wait multiple seconds for a response from the Rutter API.
  • You want to make a large set of operations at the same time. This allows Rutter to intelligently avoid rate limit when making many requests to an external platform.

Response Mode: Prefer Sync

If you set response_mode to be prefer_sync, the request will try to return a synchronous response if the entire product is created within 30 seconds. If it takes longer, we will return an async_response object that you can use to query the status of the request, which will continue to make progress on our server. This async_response object is the same format as if you specified response_mode=async.

Response Mode: Async

If you set response_mode to be async, the request will be run asynchronously and the API will immediately return an async_response. Query the response_url field on async_response for the status of the request. The Async Response

If an async_response is returned, is has the following properties:

PropertyTypeDescription
idStringA unique UUID string representing the ID of the Async Job.
response_urlStringA link to the Fetch a Job endpoint. By making a GET request to this URL, you can retrieve the status and result of the job.
statusStringThe status of the job. One of the following
  • prequeued
  • pending
  • success
  • failure

We suggest querying the response_url field on async_response for the status of the request. The response_url corresponds to another API, the Fetch a Job API, and will return the successful result or errors encountered during the request.

Async Job Webhook

When an Asynchronous Job is successful, we will also send a webhook to you configured webhook URLs.

JSON
{
  "type": "JOB",
  "code": "JOB_COMPLETED",
  "job": {
    "id": "3446b185-117f-46bc-939b-aa53de5c35c1",
    "status": "success",
    "request": {
      "url": "https://production.rutterapi.com/versioned/products",
      "method": "POST",
      "body": {
        // Asynchronous Job Request Body
      }
    },
    "response": {
      "http_status": 200,
      "body": {
        // Asynchronous Job Response Body
      }
    }
  }
}

The AsynchronousJob object

Properties

idstring
statusenum
One ofprequeuedpendingsuccesspartial_success, or failure.
responseobjectoptional
Show response attributes
requestobject
Show request attributes

Fetch a Job

GET /jobs/:id
Supported for: All Platforms

Request Parameters

    idstringpath

    The ID of the job.

Response Body

    idstring
    statusenum
    One ofprequeuedpendingsuccesspartial_success, or failure.
    responseobjectoptional
    Show response attributes
    requestobject
    Show request attributes