Customers
This is used to view, create, update and delete customers.
Customer Properties
| id |
{ "id" : 255 }
The unique ID of the customer |
| trade |
{ "trade" : true }
Either true or false (set to false if it is a normal customer) |
| active |
{ "active" : true }
Either true or false |
| firstName |
{ "firstName" : "Joe" }
The customer's first name |
| lastName |
{ "lastName" : "Bloggs" }
The customer's last name |
{ "email" : "joebloggs@hotmail.com" }
The customer's email address |
|
| phone |
{ "phone" : "07900 900 900" }
The customer's phone number |
| addressLine1 |
{ "addressLine1" : "Flat 1" }
The first line of the customer's address |
| addressLine2 |
{ "addressLine2" : "Acacia House" }
The second line of the customer's address |
| addressLine3 |
{ "addressLine3" : "1a Acacia Avenue" }
The third line of the customer's address |
| city |
{ "city" : "London" }
The town/city for the customer |
| postcode |
{ "postcode" : "W1U 6PZ" }
The customer's postcode |
| country |
{ "country" : { "id": 223 } }
The customer's country, using the country object |
| state |
{ "state" : { "id": 2 } }
The customer's state, using the state object |
| notes |
{ "notes" : "fussy customer" }
Notes about the customer record |
| rewardPoints |
{ "rewardPoints" : 30 }
The number of reward points the customer currently has |
The following properties are only available for regular customers.
| acceptsMarketing |
{ "acceptsMarketing" : true }
Either true or false, whether the customer has indicated they will accept marketing communications |
The following properties are only available for trade customers.
| companyName |
{ "companyName" : "Acme Leisure Ltd" }
The name of the company |
| mobilePhone |
{ "mobilePhone" : "07900 900 900" }
The mobile phone number |
| website |
{ "website" : "www.acmeleisure.com" }
The website of the company |
| vatNumber |
{ "vatNumber" : "GB12345678" }
The company's VAT number |
| tradeGroupId |
{ "tradeGroupId" : 1042 }
The ID of the trade pricing band that the customer belongs to |
| additionalData |
{ "additionalData": {
"0": "Gas Safe Number: 3857H338",
"1": "Internal ID: 28493",
"2": "Additional Contact: Joe Bloggs"
}
}
Any additional information stored against the customer record in the additional data fields, up to 5 fields are allowed |
The trade property is only available when creating a customer.
The password, country and state properties are only available when creating/updating a customer.
What you can do with Customers
GET /v1/customers
Receive a list of all customers
GET /v1/customers/count
Count the number of customers
GET /v1/customers/ID
Receive a single customer
POST /v1/customers
Create a new customer
PUT /v1/customers/ID
Update a customer
DELETE /v1/customers/ID
Delete a customer
GET /v1/customers
Returns all customers. By default the first 50 regular customers are returned, sorted by creation date.
| embed | country or state |
| fields | Comma separated list of properties to include |
| sort | name, name_desc, company or company description (default is creation date) |
| trade | 0 or 1 |
| count | Count |
| offset | Offset |
GET /v1/customers
HTTP/1.1 200 OK
[
{
"id": 1434,
"trade": false,
"active": true,
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"phone": "",
"acceptsMarketing": false,
"addressLine1": "",
"addressLine2": "",
"addressLine3": "",
"city": "",
"postcode": "",
"country": {
"id": 222
},
"state": {
"id": 0
},
"notes": "this customer is fussy"
}
]
GET /v1/customers/count
Returns a count of the customers.
| trade | 0 or 1 |
GET /v1/customers/count
HTTP/1.1 200 OK
{
"count": 99
}
GET /v1/customers/ID
Returns a single customer.
| embed | country or state |
| fields | Comma separated list of properties to include |
GET /v1/customers/1
HTTP/1.1 200 OK
{
"id": 1437,
"trade": false,
"active": true,
"firstName": "Joe",
"lastName": "Bloggs",
"email": "joebloggs@hotmail.com",
"phone": "07900 900 900",
"acceptsMarketing": true,
"addressLine1": "Flat 1",
"addressLine2": "Acacia House",
"addressLine3": "1a Acacia Avenue",
"city": "London",
"postcode": "W1U 6PZ",
"country": {
"id": 223
},
"state": {
"id": 2
},
"notes": "this customer is fussy"
}
GET /v1/customers/1
{
"id": 1436,
"trade": true,
"active": true,
"firstName": "Joe",
"lastName": "Bloggs",
"companyName": "Acme Leisure Ltd",
"email": "joebloggs@acmeleisure.com",
"phone": "0121 234 5678",
"mobilePhone": "07900 900 900",
"website": "http://www.acmeleisure.com",
"vatNumber": "GB12345678",
"tradeGroupId": 1094,
"addressLine1": "Top Floor",
"addressLine2": "Acacia House",
"addressLine3": "Acacia Avenue",
"city": "London",
"postcode": "W1U 6PZ",
"country": {
"id": 223
},
"state": {
"id": 2
},
"notes": "this customer is fussy"
}
POST /v1/customers
Creates a new customer.
POST /v1/customers
POST /v1/customers
{
"trade": true,
"active": false,
"firstName": "Joe",
"lastName": "Bloggs",
"companyName": "Acme Leisure Ltd",
"email": "joebloggs@acmeleisure.com",
"phone": "0121 234 5678",
"mobilePhone": "07900 900 900",
"website": "http://www.acmeleisure.com",
"vatNumber": "GB12345678",
"tradeGroupId": 1094,
"addressLine1": "Top Floor",
"addressLine2": "Acacia House",
"addressLine3": "Acacia Avenue",
"city": "London",
"postcode": "W1U 6PZ",
"country": "223",
"state": "2",
"notes": "this customer is fussy",
"password": "pass123"
}
POST /v1/customers
HTTP/1.1 201 Created
{
"id": 1438,
"trade": true,
"active": false,
"firstName": "Joe",
"lastName": "Bloggs",
"companyName": "Acme Leisure Ltd",
"email": "joebloggs@acmeleisure.com",
"phone": "0121 234 5678",
"mobilePhone": "07900 900 900",
"website": "http://www.acmeleisure.com",
"vatNumber": "GB12345678",
"tradeGroupId": 1094,
"addressLine1": "Top Floor",
"addressLine2": "Acacia House",
"addressLine3": "Acacia Avenue",
"city": "London",
"postcode": "W1U 6PZ",
"country": {
"id": 223
},
"state": {
"id": 2
},
"notes": "this customer is fussy"
}
PUT /v1/customers/ID
Update a customer. All object properties are allowed except the trade property.
PUT /v1/customers/1438
PUT /v1/customers/1438
{
"active": true,
"vatNumber": "GB98765432",
"password": "newpass123"
}
PUT /v1/customers/1438
HTTP/1.1 200 OK
{
"id": 1438,
"trade": true,
"active": true,
"firstName": "Joe",
"lastName": "Bloggs",
"companyName": "Acme Leisure Ltd",
"email": "joebloggs@acmeleisure.com",
"phone": "0121 234 5678",
"mobilePhone": "07900 900 900",
"website": "http://www.acmeleisure.com",
"vatNumber": "GB98765432",
"tradeGroupId": 1094,
"addressLine1": "Top Floor",
"addressLine2": "Acacia House",
"addressLine3": "Acacia Avenue",
"city": "London",
"postcode": "W1U 6PZ",
"country": {
"id": 223
},
"state": {
"id": 2
},
"notes": "this customer is fussy"
}
DELETE /v1/customers/ID
Deletes an existing customer.
Returns 204 No Content on success.