Customer API
Manage customers and retrieve customer information programmatically
Overview
The Customer API allows you to retrieve customer information, search for customers, and manage customer data. Customers represent organizations or individuals that use RackCorp services.
Note: This documentation covers the main customer endpoints. Additional endpoints are available including customer creation, updates, reseller management, and partner validation. See the API endpoint reference for a complete list.
GET Get Customer
Retrieve a single customer by ID.
Request
{
"cmd": "customer.get",
"id": 123
}
<?php
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=customer.get&id=123');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_JWT_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests
response = requests.get(
'https://api.rackcorp.net/api/rest/v2.9/json.php',
params={
'cmd': 'customer.get',
'id': 123
},
headers={
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
)
data = response.json()
curl -X GET "https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=customer.get&id=123" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET https://api.rackcorp.net/api/rest/v2.9/customers/123 Authorization: Bearer YOUR_JWT_TOKEN
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cmd |
string | Yes | Must be "customer.get" |
id |
integer | Yes | Customer ID |
Response
{
"code": "OK",
"customer": {
"id": 123,
"companyName": "Example Corp",
"stdName": "Example Corp",
"firstName": "John",
"lastName": "Doe",
"companyABN": "12345678901",
"companyACN": "123456789",
"customID": "CUST-001",
"status": "ACTIVE",
"parentID": null,
"parentStdName": null,
"dateCreated": 1699123456,
"dateModified": 1699123456,
"currency": "AUD",
"isreseller": false,
"locations": [...],
"contacts": [...]
}
}
GET List Customers
Retrieve a list of customers with optional filtering and pagination.
Request
{
"cmd": "customer.getall",
"resStart": 0,
"resWindow": 50,
"keyword": "search term",
"stdName": "Example Corp",
"status": "ACTIVE",
"customerParentId": 456,
"minimal": false
}
<?php
$params = http_build_query([
'cmd' => 'customer.getall',
'resStart' => 0,
'resWindow' => 50,
'keyword' => 'search term',
'status' => 'ACTIVE'
]);
$ch = curl_init('https://api.rackcorp.net/api/rest/v2.9/json.php?' . $params);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_JWT_TOKEN'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
?>
import requests
response = requests.get(
'https://api.rackcorp.net/api/rest/v2.9/json.php',
params={
'cmd': 'customer.getall',
'resStart': 0,
'resWindow': 50,
'keyword': 'search term',
'status': 'ACTIVE'
},
headers={
'Authorization': 'Bearer YOUR_JWT_TOKEN'
}
)
data = response.json()
curl -X GET "https://api.rackcorp.net/api/rest/v2.9/json.php?cmd=customer.getall&resStart=0&resWindow=50&keyword=search%20term&status=ACTIVE" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
GET https://api.rackcorp.net/api/rest/v2.9/customers?resStart=0&resWindow=50&keyword=search%20term&status=ACTIVE Authorization: Bearer YOUR_JWT_TOKEN
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cmd |
string | Yes | Must be "customer.getall" |
resStart |
integer | No | Pagination start offset (default: 0) |
resWindow |
integer | No | Number of results per page (default: 20, minimum: 20) |
id |
integer | No | Filter by customer ID |
keyword |
string | No | Search term to filter results (searches across multiple fields) |
stdName |
string | No | Filter by standard name (company name) |
companyName |
string | No | Filter by company name |
status |
string | No | Filter by status (e.g., "ACTIVE", "INACTIVE") |
customerParentId |
integer | No | Filter by parent customer ID (for reseller hierarchies) |
minimal |
boolean | No | If true, returns minimal customer data (id and stdName only) for faster responses |
Response
{
"code": "OK",
"count": 25,
"customers": [
{
"id": 123,
"companyName": "Example Corp",
"stdName": "Example Corp",
"firstName": "John",
"lastName": "Doe",
"status": "ACTIVE",
"dateCreated": 1699123456,
"dateModified": 1699123456,
"currency": "AUD",
"isreseller": false
}
]
}
GET List Customers (Minimal)
Retrieve a minimal list of customers with only ID and standard name. This endpoint is faster than customer.getall when you only need basic customer information.
Request
GET /api/rest/v2.9/customers/min?resStart=0&resWindow=50
Parameters
Same parameters as customer.getall, but results are always returned in minimal format (id and stdName only).
Response
{
"code": "OK",
"count": 25,
"customers": [
{
"id": 123,
"stdName": "Example Corp"
}
]
}
GET Check Partner Code
Validate a partner registration code.
Request
GET /api/rest/v2.9/customer/partner?CODE=PARTNER123
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
CODE |
string | Yes | Partner registration code to validate |
Response
{
"code": "OK",
"message": "Partner Code is valid",
"partnercheck": {
"customerid": 456
}
}
GET Get Resellers
Retrieve reseller information for the authenticated customer.
Request
GET /api/rest/v2.9/customers/reseller
Response
{
"code": "OK",
"message": "Resellers Data retrieved successfully",
"data": [...]
}
POST Create Customer
Create a new customer account. Requires appropriate permissions.
Request
POST /api/rest/v2.9/customers
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"companyName": "Example Corp",
"status": "ACTIVE",
"customID": "CUST-001",
"parentID": 0,
"currencycode": "AUD",
"customerTierID": "DEFAULT",
"promoCode": "",
"autobilling": 1,
"locations": [
{
"typeOfAddress": "primary",
"addressLine1": "123 Main St",
"addressLine2": "",
"addressLine3": "",
"suburb": "Sydney",
"state": "NSW",
"postcode": "2000",
"country": "AU"
}
],
"contacts": [
{
"typeOfContact": "administrative",
"name": "John Doe",
"phoneNumber": "+61 2 1234 5678",
"mobileNumber": "+61 4 1234 5678",
"faxNumber": "",
"email": "john@example.com"
}
]
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
firstName |
string | No* | First name (required if companyName not provided) |
lastName |
string | No* | Last name (required if companyName not provided) |
companyName |
string | No* | Company name (required if firstName/lastName not provided) |
status |
string | No | Customer status (default: "ACTIVE") |
customID |
string | No | Custom identifier for the customer |
parentID |
integer | No | Parent customer ID (defaults to authenticated customer) |
currencycode |
string | No | Primary currency code (e.g., "AUD", "USD") |
customerTierID |
string | No | Customer tier ID ("DEFAULT", 1, 2, or 3) |
promoCode |
string | No | Promotional code to apply |
autobilling |
integer | No | Enable auto-billing (1 = enabled) |
locations |
array | Yes | Array of location objects (at least one required) |
contacts |
array | Yes | Array of contact objects (at least one required) |
* Either firstName/lastName OR companyName must be provided
Response
{
"code": "OK",
"message": "Customer Created Successfully",
"customerid": 789
}
POST Customer Signup
Create a new customer account with an associated user account. The user account will be created in INACTIVE status and requires manual activation.
Request
Same request format as customer.create, with additional user fields:
POST /api/rest/v2.9/customers/signup
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"companyName": "Example Corp",
"userLogin": "john@example.com",
"userPassword": "secure_password",
"locations": [...],
"contacts": [...]
}
Response
{
"code": "OK",
"message": "Customer Created Successfully",
"customer": {
"customerid": 789,
"userid": 456
}
}
POST Create Reseller
Create a reseller portal for a customer.
Request
POST /api/rest/v2.9/customers/reseller
Content-Type: application/json
{
"customerid": 123,
"name": "Reseller Portal Name",
"url": "https://reseller.example.com"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customerid |
integer | Yes | Customer ID to create reseller portal for |
name |
string | Yes | Reseller portal name |
url |
string | Yes | Reseller portal URL (must be valid URL) |
Response
{
"code": "OK",
"message": "Reseller Created Successfully"
}
POST Send Contact Email
Send a contact/sales inquiry email for a customer.
Request
POST /api/rest/v2.9/customers/123/contact
Content-Type: application/json
{
"companyname": "Example Corp",
"name": "John Doe",
"email": "john@example.com",
"phone": "+61 2 1234 5678",
"message": "I'm interested in your services..."
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
companyname |
string | Yes | Company name |
name |
string | Yes | Contact person name |
email |
string | Yes | Contact email address |
phone |
string | No | Contact phone number |
message |
string | Yes | Message content |
Response
{
"code": "OK",
"message": "Email send successfully.
One of our sales team will contact you soon. Thanks for your enquiry"
}
PUT Update Customer
Update an existing customer's information.
Request
PUT /api/rest/v2.9/customers/123
Content-Type: application/json
{
"id": 123,
"firstName": "John",
"lastName": "Doe",
"companyName": "Updated Corp Name",
"status": "ACTIVE",
"promoCode": "PROMO123"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | Customer ID to update |
firstName |
string | No | Updated first name |
lastName |
string | No | Updated last name |
companyName |
string | No | Updated company name |
status |
string | No | Updated status |
promoCode |
string | No | Promotional code to apply (must be valid) |
Note: Most customer fields can be updated. See customer object fields for available fields.
Response
{
"code": "OK",
"message": "Customer Updated Successfully"
}
Customer Object Fields
| Field | Type | Description |
|---|---|---|
id |
integer | Unique customer identifier |
companyName |
string | Company or organization name |
stdName |
string | Standardized company name |
firstName |
string | First name (for individual customers) |
lastName |
string | Last name (for individual customers) |
companyABN |
string | Australian Business Number |
companyACN |
string | Australian Company Number |
customID |
string | Custom identifier assigned to the customer |
status |
string | Customer status (e.g., "ACTIVE", "INACTIVE") |
parentID |
integer | Parent customer ID (for reseller hierarchies) |
parentStdName |
string | Parent customer standard name |
dateCreated |
integer | Unix timestamp of creation date |
dateModified |
integer | Unix timestamp of last modification |
currency |
string | Primary currency code (e.g., "AUD", "USD") |
isreseller |
boolean | Whether the customer is a reseller |
locations |
array | Array of customer location objects |
contacts |
array | Array of customer contact objects |
Error Responses
If an error occurs, the API will return a response with code: "FAULT":
{
"code": "FAULT",
"message": "Error message",
"error": {
"field1": "Error message 1",
"field2": "Error message 2"
}
}
Common error scenarios:
- Invalid customer ID
- Permission denied
- Customer not found