Follow

GET /customers?offset={index}

Allows you to pull a list of all customers setup in the PayJunction account.

Production Request

curl -X GET -u "login:password" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \
    "https://api.payjunction.com/customers?offset=0"

Sandbox Request

curl -X GET -u "pj-ql-01:pj-ql-01p" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_LABS_APP_KEY" \
    "https://api.payjunctionlabs.com/customers?offset=0"

The above will return the first 50 records (index 0-49). To pull the next 50 records send offset=50 (index 50-99). Generally it is easiest to grab the URL in the "next" parameter returned in the response to get the correct index for the next set of records. The next field will not be set once you have reached the last page, therefore it is important to verify the parameter exists in the response before referencing it in your code (isset() in PHP and hasOwnProperty() in JavaScript).

Example Response

{
     'next': 'https://api.payjunctionlabs.com/customers?offset=50',
     'results': [
          {
               'created': '2016-11-07T18:10:58Z',
               'customerId': 7229,
               'defaultAddress': 
                    {
                         'addressId': 5851,
                          'uri': 'https://api.payjunctionlabs.com/customers/7229/addresses/5851'
                    },
               'firstName': 'Scot',
               'lastModified': '2016-11-07T18:10:58Z',
               'lastName': 'Martinelli',
               'uri': 'https://api.payjunctionlabs.com/customers/7229'
          },
          {
               'created': '2016-11-07T02:27:14Z',
               'customerId': 7199,
               'defaultAddress': 
                    {
                         'addressId': 5847,
                         'uri': 'https://api.payjunctionlabs.com/customers/7199/addresses/5847'
                    },
               'firstName': u'Brian',
               'lastModified': u'2016-11-07T02:27:14Z',
               'lastName': u'Brown',
               'uri': u'https://api.payjunctionlabs.com/customers/7199'},
              ...
          {
               'created': '2016-10-28T21:21:38Z',
               'customerId': 7041,
               'defaultAddress': 
                    {
                         'addressId': 5747,
                         'uri': 'https://api.payjunctionlabs.com/customers/7041/addresses/5747'
                    },
               'firstName': 'MARISOL',
               'identifier': 'T977DCALOA01',
               'lastModified': '2016-10-28T21:21:38Z',
               'lastName': 'TESTCASE',
               'uri': 'https://api.payjunctionlabs.com/customers/7041'
           }
     ]
}