Batch

Batch Documentation

Batch [POST]

A batch endpoint that allows you to send an array of requests. It expects a JSON payload with a requests key that has an array of request objects. A request object needs to have a method key and a path key. It may also have a body key. The response will be a JSON array of response objects. A response object has a status key, a headers key, and a body key. The body is a string of the server response. In addition to the requests key in the payload, you may also specify a on_error key which may be set to CONTINUE, or ABORT. CONTINUE is the default, and it will return a 200 no matter what, and give a response for every request, no matter if they errored or not. ABORT will end the batch request early if one of the requests fails. The batch response will have the status code of the failing request, and the response will include responses up to and including the errored request, but no more. Some endpoints are unable to be used within a batch request. At this time, only bulk endpoints are disallowed from being used in a batch request.

Request has three fields.

  • Method: GET, POST, PATCH, PUT or DELETE

  • Path: The path portion of the URI of the request e.g /api/v2/tasks

  • Body: The JSON body of the request

Request

Endpoint

POST /api/v2/batch
Content-Type: application/vnd.api+json

Body

{
  "requests": [
    {
      "method": "GET",
      "path": "/api/v2/account_lists/f8324138-1616-4f1e-bb56-96a619a52ec8/donations"
    },
    {
      "method": "PATCH",
      "path": "/api/v2/tasks/e8f66050-c8a6-4dda-8cf5-95179ab27b6b",
      "body": {
        "data": {
          "id": "e8f66050-c8a6-4dda-8cf5-95179ab27b6b",
          "type": "tasks",
          "attributes": {
            "subject": "Random Task Subject",
            "overwrite": true
          }
        }
      }
    }
  ]
}

Parameters

Attributes

created_at

Type date

Description The timestamp of when this resource was created

Required No

updated_at

Type date

Description The timestamp of when this resource was last updated

Required No

updated_in_db_at

Type date

Description This is to be used as a reference for the last time the resource was updated in the remote database - specifically for when data is updated while the client is offline.

Required No

Response

Headers

Content-Type: application/json
200 OK

Body

[
  {
    "status": 200,
    "headers": {
      "X-Frame-Options": "SAMEORIGIN",
      "X-XSS-Protection": "1; mode=block",
      "X-Content-Type-Options": "nosniff",
      "X-Download-Options": "noopen",
      "X-Permitted-Cross-Domain-Policies": "none",
      "Referrer-Policy": "strict-origin-when-cross-origin",
      "Content-Type": "application/vnd.api+json; charset=utf-8",
      "ETag": "W/\"20a91bc434d83cb48991099b2d115968\"",
      "Cache-Control": "max-age=0, private, must-revalidate"
    },
    "body": "{\"data\":[],\"meta\":{\"pagination\":{\"page\":1,\"per_page\":25,\"total_count\":0,\"total_pages\":0},\"sort\":null,\"filter\":{},\"totals\":[]}}"
  },
  {
    "status": 200,
    "headers": {
      "X-Frame-Options": "SAMEORIGIN",
      "X-XSS-Protection": "1; mode=block",
      "X-Content-Type-Options": "nosniff",
      "X-Download-Options": "noopen",
      "X-Permitted-Cross-Domain-Policies": "none",
      "Referrer-Policy": "strict-origin-when-cross-origin",
      "Content-Type": "application/vnd.api+json; charset=utf-8",
      "ETag": "W/\"bbae606234864342afc75db8267ba428\"",
      "Cache-Control": "max-age=0, private, must-revalidate"
    },
    "body": "{\"data\":{\"id\":\"e8f66050-c8a6-4dda-8cf5-95179ab27b6b\",\"type\":\"tasks\",\"attributes\":{\"activity_type\":\"Call\",\"comments_count\":0,\"completed\":false,\"completed_at\":null,\"created_at\":\"2022-01-12T17:18:37Z\",\"location\":\"MyString\",\"next_action\":null,\"notification_time_before\":null,\"notification_time_unit\":null,\"notification_type\":null,\"result\":null,\"starred\":false,\"start_at\":\"2012-03-08T14:59:46Z\",\"subject\":\"Random Task Subject\",\"subject_hidden\":false,\"tag_list\":[],\"updated_at\":\"2022-01-12T17:18:38Z\",\"updated_in_db_at\":\"2022-01-12T17:18:38Z\"},\"relationships\":{\"user\":{\"data\":null},\"comments\":{\"data\":[]},\"contacts\":{\"data\":[]},\"people\":{\"data\":[]},\"email_addresses\":{\"data\":[]},\"phone_numbers\":{\"data\":[]},\"activity_contacts\":{\"data\":[]},\"account_list\":{\"data\":{\"id\":\"f8324138-1616-4f1e-bb56-96a619a52ec8\",\"type\":\"account_lists\"}}}}}"
  }
]

Fields

Attributes

created_at

Type date

Description The timestamp of when this resource was created

updated_at

Type date

Description The timestamp of when this resource was last updated

updated_in_db_at

Type date

Description This is to be used as a reference for the last time the resource was updated in the remote database - specifically for when data is updated while the client is offline.

Last updated