Batch List

Overview

This page will show you how to get a list of batches. The API endpoint below gets a list of batches in descending order starting with the newest. This list can have its results offset or have its results filtered by date.

The API endpoint is as follows:

GET /api/v2/batches/

Quick Start

Request

curl -X GET https://sandbox.usaepay.com/api/v2/batches
  -H "Content-Type: application/json"
  -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant viewing a list of their batches.

Response

{  
   "type":"list",
   "limit":20,
   "offset":0,
   "data":[  
      {  
         "type":"batch",
         "key":"8t1ssndhrhzxy8d",
         "batchnum":"2",
         "opened":"2017-10-23 16:16:56"
      },
      {  
         "type":"batch",
         "key":"3t1s0n4spz0grp3",
         "batchnum":"1",
         "opened":"2017-10-19 11:29:41",
         "closed":"2017-10-19 12:31:02"
      },

      ...

      {  
         "type":"batch",
         "key":"dt1sb20s8b4qm73",
         "batchnum":"1",
         "opened":"2017-09-26 10:32:53",
         "closed":"2017-09-26 18:16:02"
      }
   ],
   "total":"93"
}

This is the sample response object sent back from the server. The data field will have details of up to 20 batches because of the default limit.

Request Parameters

These are a list of optional parameters which can be sent with the GET request to manipulate results.

Parameter Name Type Description
limit integer The amount of batches to return. If not set, there will be up to 20 batches returned.
offset integer The amount of batches to skip in the results. Used for pagination.
openedlt date(YYYYmmdd) Will include the results that are opened before this date.
openedgt date(YYYYmmdd) Will include the results that are opened after this date.
closedlt date(YYYYmmdd) Will include the results that are closed before this date.
closedgt date(YYYYmmdd) Will include the results that are closed after this date.
openedle date(YYYYmmdd) Will include the results that are opened before this date. (Including this date)
openedge date(YYYYmmdd) Will include the results that are opened after this date. (Including this date)
closedle date(YYYYmmdd) Will include the results that are closed before this date. (Including this date)
closedge date(YYYYmmdd) Will include the results that are closed after this date. (Including this date)

Response Variables

Variable Type Description
type string The type of object returned. Returns a list.
limit integer The maximum amount of batches that will be included.
offset integer The number of batches skipped from the results
data array of batch A result list of batches.
total integer The total amount of batches, including filtering results.

Object Definitions

batch

This response object holds information associated with the batch.

Parameter Name Type Description
type string This is a batch.
key string This is the key of the batch.
batchnum string The batch sequence number. The first batch the merchant closes is 1, the second is 2, etc.
opened date The date when this batched opened
closed date The date when this batch closed

Sample Code

Limit

To adjust the limit of the results:

curl -X GET https://sandbox.usaepay.com/api/v2/batches?limit=2
  -H "Content-Type: application/json"
  -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant viewing a smaller amount of batches.

{  
   "type":"list",
   "limit":2,
   "offset":0,
   "data":[  
      {  
         "type":"batch",
         "key":"8t1ssndhrhzxy8d",
         "batchnum":"2",
         "opened":"2017-10-23 16:16:56"
      },
      {  
         "type":"batch",
         "key":"3t1s0n4spz0grp3",
         "batchnum":"1",
         "opened":"2017-10-19 11:29:41",
         "closed":"2017-10-19 12:31:02"
      }
   ],
   "total":"93"
}

This is the sample response object sent back from the server.

Offset

To offset the results:

curl -X GET https://sandbox.usaepay.com/api/v2/batches?limit=5&offset=10
  -H "Content-Type: application/json"
  -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant viewing their third set of data.

{  
   "type":"list",
   "limit":5,
   "offset":10,
   "data":[  
      {  
         "type":"batch",
         "key":"ft1ss99jfmkrsd8",
         "batchnum":"1",
         "opened":"2017-10-04 14:01:52",
         "closed":"2017-10-05 10:31:02"
      },
      {  
         "type":"batch",
         "key":"lt1s38k8zyqd9t0",
         "batchnum":"1",
         "opened":"2017-10-03 10:46:49",
         "closed":"2017-10-04 10:31:01"
      },

      ...

      {  
         "type":"batch",
         "key":"it1sbw66z0h72g0",
         "batchnum":"1",
         "opened":"2017-10-02 09:27:11",
         "closed":"2017-10-02 17:01:17"
      }
   ],
   "total":"93"
}

This is the sample response object sent back from the server.

Filter By Date

Filters the results by adding search parameters. Dates should be given as (YYYYmmdd) format such as below.

curl -X GET https://sandbox.usaepay.com/api/v2/batches?openedge=20171003&openedlt=20171004
  -H "Content-Type: application/json"
  -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2"

This cURL request is an example of a merchant finding batches which opened on exactly October 3rd.

{  
   "type":"list",
   "limit":20,
   "offset":0,
   "data":[  
      {  
         "type":"batch",
         "key":"lt1s38k8zyqd9t0",
         "batchnum":"1",
         "opened":"2017-10-03 10:46:49",
         "closed":"2017-10-04 10:31:01"
      },
      {  
         "type":"batch",
         "key":"kt1swm641hbwm0x",
         "batchnum":"1",
         "opened":"2017-10-03 10:08:45",
         "closed":"2017-10-03 10:31:02"
      }
   ],
   "total":"2"
}

This is the sample response object sent back from the server.

Change Log

Date Change
2017-08-01 Added page.
2017-11-29 Added code examples to page.

Click here for the full REST API change log.