The Get Customer API retrieves basic information about a customer. This does not include detailed information such as recent orders (which is included in results of Customer Search requests) when a customer ID is appended to the endpoint as shown in the table below.
However, to obtain that information for a particular customer then doing a search such as /?customerID={customerID} instead of /{customerID} will provide those extended details. See the examples below for a comparison of these responses.
The data returned by this request is the exact same as in the previous version of OMS, as the Unified Commerce platform supports backwards compatibility for this API. The only change to this request is the format of the base endpoint, as shown in the below table. Remember to provide the x-vol-tenant key for authentication in the headers.
Production URL | https://{tenantId}-translation.mozu.com/api/v2/customer/{customerID} |
Sandbox URL | https://{tenantId}-translation.sandbox.mozu.com/api/v2/customer/{customerID} |
Supported Formats | JSON |
HTTP Method | GET |
Example
In this example, the customer details includes these particular properties:
- Customer ID 0123456
- Name “Example User” with all identifying and contact information
- No custom data
General Information
The response returns the following information about a customer:
- Identification (name, password)
- Contact Information
- Account Activity Flag (active, inactive, or frozen)
The Basic Request
Using the basic GET URL format as outlined in the table above, the entire call is simple to put together.
https://{tenantId}-translation.mozu.com/api/v2/customer/0123456
The response will look like the below example. If the customer information includes custom data, that will be added to this response in a customData block.
{ "customerID": "0123456", "firstName": "Example", "lastName": "User", "email": "example@shopatron.com", "password": "*****", "phone1": "0000000000", "active": "ACTIVE" }
The Search Request
But as mentioned, altering this into a highly specific search request returns more information that may be useful in place of the standard GET request.
https://{tenantId}-translation.mozu.com/api/v2/customer/?customerID=0123456
See how the response below includes information such as customer activity, previous addresses, total orders, etc.
{ "collection": [ { "active": "ACTIVE", "customerID": "0123456", "email": "example@shopatron.com", "firstName": "Example", "firstPurchase": "2016-10-16T16:13:00+00:00", "lastName": "User", "lastLogin": "2016-10-16T16:13:00+00:00", "lastPurchase": "2016-10-16T16:13:00+00:00", "phones": [ "0000000000" ], "recentAddresses": [ "111 EXAMPLE LN, DALLAS, US" ], "recentOrders": [ 6543210 ], "totalOrders": 1 } ] }