Skip to main content

How to get a list of Customers

This document is designed to help you understand how you can fetch a list of Customers with search parameters customizations. The endpoint enables user to get a list of customers that contains a particular string ({{searchTerm}}) in multiple fields({{fieldsToBeSearched}}) like ID, firstName, communications etc. and one can control to combine the results from the searchTerm being present in different fieldsToBeSearched by AND or OR. The list contains an array of objects which contains a sub-object named customer which contains all the customer information and a sub-object named vehicles which contains all the vehicles owned by the customer.
To get a customer list, you first need your credentials. If you don't already have one, head over to the Authentication and Authorization page to see how you can request for credentials from us. The endpoint mentioned below can help you with getting a customer list and customize the search parameters :-

Parameters Used

Parameter NameDescriptionRequiredDefault Value
{{fieldsToBeSearched}}Fields in which {{searchTerm}} will be searched for and matching customers will be fetchedFalseset of fields like firstName, lastName, ID etc.
{{maxResults}}Size of customer list that will be returned. Could be any number from 1 to 100False100
{{queryOperator}}Combine the search results by searching for the {{searchTerm}} in different {{fieldsToBeSearched}} by AND or ORFalseAND
{{searchPreference}}Which entity search is preferred Customer or VehicleFalseCustomer
{{searchTerm}}String that will be looked for in the {{fieldsToBeSearched}} and its presence in either all the fields or at least one field controlled by {{queryOperator}} decides whether or not the customer result will be returned in the response list. Maximum length of this search term is 30True---
{{serviceSubscriberDepartmentToken}}UUID of service subscriberTrue---
{{basic_auth_token}}Authorization: Basic generate using username passwordTrue---

Scope

  1. The service subscriber needs to have the following scope - customer.search

Endpoint

curl -X GET "https://api.mykaarma.com/customer/v2/department/{{serviceSubscriberDealerDepartmentToken}}/customer/list?fieldsToBeSearched={{fieldsToBeSearched}}&maxResults={{maxResults}}&queryOperator={{queryOperator}}&searchPreference={{searchPreference}}&searchTerm={{searchterm}}" 
-H "accept: application/json"
-H "authorization: {{basic_auth_token}}"

Response

{
"errors": [
{
"errorCode": 0,
"errorMessage": "string",
"errorTitle": "string"
}
],
"matchingCount": 0,
"matchingCustomers": [
{
"customer": {
"addresses": [
{
"addressType": "string",
"city": "string",
"country": "string",
"line1": "string",
"line2": "string",
"position": {
"altitude": 0,
"id": 0,
"latitue": 0,
"longitude": 0
},
"state": "string",
"zip": "string"
}
],
"bestTimeToContact": {
"endTime": "string",
"startTime": "string"
},
"company": "string",
"customerId": "string",
"customerKey": "string",
"customerUuid": "string",
"emails": [
{
"emailAddress": "string",
"isPreferred": true,
"label": "string",
"okToEmail": true
}
],
"firstName": "string",
"id": 0,
"isBusiness": true,
"lastName": "string",
"phoneNumbers": [
{
"isPreferred": true,
"label": "string",
"okToCall": true,
"okToText": true,
"phoneNumber": "string"
}
],
"preferredCommunication": "string",
"preferredLocale": "string"
},
"vehicles": [
{
"brandId": 0,
"estimatedMileage": "string",
"id": 0,
"imageUrl": "string",
"isValid": true,
"vehicleEngine": "string",
"vehicleKey": "string",
"vehicleMake": "string",
"vehicleModel": "string",
"vehicleTrim": "string",
"vehicleUuid": "string",
"vehicleYear": "string",
"vin": "string"
}
]
}
],
"warnings": [
{
"warningCode": 0,
"warningMessage": "string",
"warningTitle": "string"
}
]
}

Quick summary of getCustomer response fields

Parameter NameDescription
addresses.addressTypeEnum with possible values COMMON, PRIMARY, BILLING, OTHER and tells type of address
customerIdUnique identifier used by mykaarma to uniquely identify each customer in mykaarma databases
customerKeyUnique identifier used by DMS to uniquely identify each customer, used by mykaarma to lookup customers in DMS databases for various purposes like updation, deletion, booking appointment etc.
customerUuidUnique identifier used by mykaarma in addition to customerId, used for uniquely identifying customers over API calls(for read, write, update, delete purposes) without revealing their database id that is customerId
emails.labelIt tells the type of email example personal
phoneNumbers.labelIt tells the type of phone example cell, home, work etc.
isPreferredIt is a boolean value which tells which phone and which email is preferred for use by a customer, only one phone and one email can have isPreferred true for a customer
isBusinessBoolean value which tells whether the customer is an INDIVIDUAL customer or a BUSINESS customer
preferredCommunicationString which tells which mode of communication is preferred by the customer to be contacted
vehicles.idUnique identifier used by mykaarma to uniquely identify each vehicle in mykaarma databases
vehicles.vehicleKeyUnique identifier used by DMS to uniquely identify each vehicle, used by mykaarma to lookup vehicles in DMS databases for various purposes like updation, deletion, booking appointment etc.
vehicles.vehicleUuidUnique identifier used by mykaarma in addition to vehicles.id, used for uniquely identifying vehicles over API calls(for read, write, update, delete purposes) without revealing their database id that is vehicles.id