Link Search Menu Expand Document

Batches

Batches enable bulk loading of resource onto the Centrapay platform.

Contents

Models

Batch

The batch model represents the progression for loading of a file.

Fields

Field Type Description
id String The Batch’s unique identifier.
status String The current Lifecycle Stage of the batch.
type String Batch Type id used to describe the batch content.
totalCount BigNumber The number of items processed.
errorCount BigNumber Total Error counted.
errors Array Error list for the batch.
test Boolean Optional true if the batch is for testing purposes only.

Batch Lifecycle

Different stages of a Batch’s lifecycle.

Status Description
created The batch has successfully been submitted.
copied The file has been transferred to Centrapay.
chunked The batch has been broken up for processing.
complete The batch has been processed and may include errors.
error There is an error accessing or reading the file, preventing processing.

Batch Types

The following table describes the Batch Types supported for loading.

Type Description
farmlands-external-asset Farmlands External Asset Batch.
verifone-terminal-status Verifone Terminal Status Batch.

Error

An Error represents the complete or partial failure of the batch. This could be caused by the contents, access or file format.

Fields

Field Type Description
message String A description of what caused the Error.
externalId String Optional Field used in debugging in reference to an id from the file.
index BigNumber Optional Item offset where the Error was identified in the file.

Operations

Create Batch EXPERIMENTAL

Initialize loading of entities from a batch file.

POST /api/batches

curl -X POST https://service.centrapay.com/api/batches \
  -H "X-Api-Key: $api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "farmlands-external-asset",
    "url": "https://azurebuckets.com/1234",
    "accountId": "C4QnjXvj8At6SMsEN4LRi9",
    "test": true
  }'

Fields

Field Type Description
type String Batch Type used to describe the batch content.
url String The url where the file is located.
accountId String Centrapay Account Id that submitted the Batch.
test Boolean Optional true if the batch is for testing purposes only.

Example Response Payload

{
  "id": "AVH5uG4gRLYK6YR8JyrViN",
  "accountId": "1mdj7bj95gjo92r0ux6wfy69gj3h77",
  "status": "created",
  "type": "farmlands-external-asset",
  "url": "https://azurebuckets.com/1234",
  "test": true,
  "count": "0",
  "errorCount": "0",
  "errors": [

  ]
}

Error Responses

Status Code Description
403 LIVENESS_MISSMATCH accountId “test” flag is not the same as submitted Batch’s “test” flag.

Get Batch EXPERIMENTAL

GET /api/batches/{id}

curl https://service.centrapay.com/api/batches/AVH5uG4gRLYK6YR8JyrViN \
  -H "X-Api-Key: $api_key"

Example Response Payload

{
  "id": "AVH5uG4gRLYK6YR8JyrViN",
  "accountId": "1mdj7bj95gjo92r0ux6wfy69gj3h77",
  "status": "complete",
  "type": "farmlands-external-asset",
  "url": "https://azurebuckets.com/1234",
  "test": true,
  "count": "160000",
  "errorCount": "1",
  "errors": [
    {
      "externalId": "69d64d80-f9bd-4057-bc5b-1c55685d995b",
      "index": "1954",
      "message": "INVALID_BARCODE_LENGTH"
    }
  ]
}