Customers

The customers data api is used to retrieve up-to-date customer data from Custobar. Customers can be searched by customer id (external_id) or by email.

To retrieve customer with external id CUSTOMERID, make a GET request to:

https://COMPANY.custobar.com/api/data/customers/?external_id=CUSTOMERID

The result is always a JSON object with customers property, with all mathcing customers as a list

{
    "customers": [
        {
            "external_id": "CUSTOMERID",
            "first_name": "Customer",
            "last_name": "Samplesson",
            "email": "[email protected]",
            "can_email": true
        }
    ]
}

If there are no matching customers, the customers list will be empty. For external_id queries there are always either zero or one matching customers.

To retrieve customers with email address, make a similar GET request:

https://COMPANY.custobar.com/api/data/customers/[email protected]

There might be several customers with the same email address, so this could return more than one matching customer.

Specifying returned fields

By default, the customers data api returns all data associated with matching customers. If you are only interested in certain data fields, you can specify them as a comma-separated list with fields query parameters:

https://COMPANY.custobar.com/api/data/customers/?external_id=CUSTOMERID&fields=email,can_email

External_id is always included, so this will return:

{
    "customers": [
        {
            "external_id": "CUSTOMERID",
            "email": "[email protected]",
            "can_email": true
        }
    ]
}

Note that if a customer does not have a particular data field, it is not included in the result, even if the field was specified in fields parameter.