Get All Customers
Use our API to get all saved customer profiles.
This guide shows you how to use the Customer Vault API resource to get an array of Customer Vault profile data, filtered and sorted to your specifications. See Get All Customers in API Reference for field definitions.
Prerequisites
-
See Create a Sandbox Account to sign up and log in to the Maast Manager portal.
-
Follow the steps in Get Your API Credentials to save a sandbox ID and API key.
-
See Authentication to format the credentials and generate your API token. (Alternatively, use the credentials as-is to test this endpoint with our 'Try It!' feature.)
-
Follow the steps in the Add a Customer guide to add at least one customer profile to the Customer Vault.
Implement
Write a GET request to send to the /platform/vault/customer
endpoint. See the sample code below:
curl --request GET \
--url 'https://api-test.maast.com/platform/vault/customer' \
--header 'accept: application/json' \
--header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz'
The above code requests all Customer Vault objects for your account, using default sorting and no filtering.
The following sections describe several query parameters that you can add to your request to sort and filter the response. To add these parameters, append them to the request endpoint URL, preceded by ?
and separated by &
.
Sort
Use the following parameters to sort the data in the response:
- order_on - Include this to sort results by a certain field. For example, to sort by customer ID, write
order_on=customer_id
. All available fields are listed in thedata
array in the response model for this request's API Reference. - order_by - Include this to sort the specified field by ascending order (
asc
) or descending order (desc
).
Filter
Use the following parameters to filter the response:
- filter - Include this to narrow results by requiring certain fields to meet specified values. You can combine multiple filters. Each filter contains three properties, packed together with commas:
- field name - All available fields are listed in the response model of this request's API Reference.
- filter conditional - Find supported filter conditionals in About Our APIs: Filters.
- the value on which to filter
- count - Include this to set the number of records in the result.
- page - Include this to choose a page to display when there are more results than the count parameter.
- merchant_id - If you are sending this request on behalf of another merchant, include their merchant ID here.
When placing strings in URLs, be sure to use your development language's URL encoding methods (e.g., for hexadecimal, use
%2C
in lieu of a comma).
Example Request
Once configured, the code for your request will resemble the following sample code:
curl --request GET \
--url 'https://api-test.maast.com/platform/vault/customer?count=10&order_on=customer_id&order_by=desc&page=0&merchant_id=0' \
--header 'accept: application/json' \
--header 'authorization: Basic OjllZGVjMjFhMzFjMHh5ejc4OWUzMGEzNDE2YWJjMTIz'
Integrate
Once you have sent your request, you will receive a response like this from the Maast server:
{
"code": 0,
"message": "Success",
"totalPages": 1,
"totalRecords": 1,
"data": [
{
"customer_id": "JOHNDOE",
"rec_id": 0,
"node_id": 210000000289,
"customer_first_name": "JOHN",
"customer_last_name": "Doe",
"customer_firm_name": "CompanyXYZ",
"customer_phone": "999-999-9999",
"customer_email": "[email protected]",
"reference_id": "678909",
"comments": "Test comment",
"developer_id": "CompanyV2.0",
"primary_card_number": "411111xxxxxx1111",
"shipping_addresses": [
{
"shipping_id": 12345,
"shipping_first_name": "John",
"shipping_last_name": "John",
"shipping_firm_name": "CompanyXYZ",
"shipping_addr1": "123 Main Street",
"shipping_addr2": "#1234",
"shipping_city": "San Mateo",
"shipping_state": "CA",
"shipping_zip": "94402",
"shipping_zip4": "1234",
"shipping_country": "United States",
"shipping_country_code": "840",
"primary": true
}
],
"billing_cards": [
{
"card_number": "411111xxxxxx1111",
"exp_date": "0420",
"card_id": "86e1b00d9b0811e68df3069d8f743581",
"billing_first_name": "John",
"billing_last_name": "Doe",
"billing_firm_name": "CompanyXYZ",
"billing_email": [
"[email protected]",
"[email protected]"
],
"billing_addr1": "123 Main Avenue",
"billing_addr2": "#1234",
"billing_city": "San Mateo",
"billing_state": "CA",
"billing_zip": "94402",
"billing_zip4": "1234",
"billing_country": "United States",
"billing_country_code": "840",
"primary": true,
"card_type": "VS",
"verified_date": "20160530000000"
}
]
}
]
}
Check the code
field in the request response: 0
confirms success. If the value is something other than 0
, check Platform API Response Codes in Reference.
The data
field shows an array of customers and their data. The sample response above shows one customer's data.
See Get All Customers in API Reference for response field definitions.
Test and Go Live
See our Test and Go Live guide to test your API integration and to start transacting with an active production account.
Updated 12 months ago