Client FetchOne API
Retrieve a single client with detailed information including contact details and frequent flyer cards
Endpoint
GET/client/fetchOne/{id}
Retrieves comprehensive information for a single client including all contact details, addresses, and frequent flyer cards.
Authentication
Provide your API token in the request headers:
X-Api-Token: your_token_prefix.your_token_secret
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Required | Client ID in the URL path |
Note: All contact information (phones, emails, addresses, frequent flyer cards) is automatically included in the response.
Usage Examples
Get client with all details
GET /client/fetchOne/123
Alternative endpoint format
GET /client/fetchOne?id=123
Response Format
{
"success": true,
"data": {
"id": 123,
"first_name": "John",
"last_name": "Smith",
"preferred_name": "Johnny",
"title": "Mr",
"gender": "male",
"preferred_pronoun": "he/him",
"date_of_birth": "1985-06-15",
"corporate_name": null,
"corporate_trading_name": null,
"corporate_acn": null,
"corporate_abn": null,
"is_active": true,
"is_corporate": false,
"is_mailable": true,
"is_account_client": false,
"branch_id": 5,
"consultant_id": 10,
"passenger_id": null,
"referral_source_id": 3,
"group_id": null,
"bpay_crn": null,
"date_created": "2024-01-15 09:30:00",
"last_modified": "2024-01-15 10:45:00",
"modified_by": 15,
"referrer_client_id": null,
"contact": {
"emails": [
{
"email": "john.smith@email.com",
"is_preferred": true,
"is_active": true
},
{
"email": "j.smith@work.com",
"is_preferred": false,
"is_active": true
}
],
"phones": [
{
"phone": "+61 400 123 456",
"type": "Mobile",
"label": "Personal Mobile",
"is_preferred": true,
"is_active": true
},
{
"phone": "+61 3 9123 4567",
"type": "Work",
"label": null,
"is_preferred": false,
"is_active": true
}
],
"addresses": [
{
"address1": "123 Collins Street",
"address2": "Suite 456",
"city": "Melbourne",
"state": "VIC",
"country": "Australia",
"post_code": "3000",
"is_preferred": true,
"is_active": true
}
]
},
"frequent_flyer_cards": [
{
"card_name": "Qantas Frequent Flyer",
"card_company": "Qantas",
"card_class": "Gold",
"card_number": "12345678901",
"card_expiry": "2025-12-31",
"is_preferred": true,
"is_active": true
}
]
},
"timestamp": "2024-01-15T09:30:00+00:00"
}
Response Fields
Main Client Data
| Field | Type | Description |
|---|---|---|
| id | integer | Unique client identifier |
| first_name | string | Client first name (null for corporate clients) |
| last_name | string | Client last name (null for corporate clients) |
| preferred_name | string | Client's preferred name |
| title | string | Client title (Mr, Mrs, Ms, Dr, etc.) |
| gender | string | Client's gender |
| preferred_pronoun | string | Client's preferred pronouns |
| date_of_birth | date | Client's date of birth (YYYY-MM-DD) |
| corporate_name | string | Corporate name (null for individual clients) |
| corporate_trading_name | string | Corporate trading name |
| corporate_acn | string | Australian Company Number |
| corporate_abn | string | Australian Business Number |
| is_active | boolean | Whether the client is active |
| is_corporate | boolean | Whether the client is corporate or individual |
| is_mailable | boolean | Whether the client can receive mail |
| is_account_client | boolean | Whether this is an account client |
| bpay_crn | string | BPay Customer Reference Number |
Contact Information
Email Addresses
| Field | Type | Description |
|---|---|---|
| string | Email address | |
| is_preferred | boolean | Whether this is the preferred email |
| is_active | boolean | Whether this email is active |
Phone Numbers
| Field | Type | Description |
|---|---|---|
| phone | string | Phone number |
| type | string | Phone type (Mobile, Work, Home, Fax, etc.) |
| label | string | Custom label for the phone number |
| is_preferred | boolean | Whether this is the preferred phone number |
| is_active | boolean | Whether this phone number is active |
Addresses
| Field | Type | Description |
|---|---|---|
| address1 | string | Primary address line |
| address2 | string | Secondary address line |
| city | string | City name |
| state | string | State or province |
| country | string | Country name |
| post_code | string | Postal/ZIP code |
| is_preferred | boolean | Whether this is the preferred address |
| is_active | boolean | Whether this address is active |
Frequent Flyer Cards
| Field | Type | Description |
|---|---|---|
| card_name | string | Name of the frequent flyer program |
| card_company | string | Airline or company name |
| card_class | string | Membership class (Gold, Silver, Platinum, etc.) |
| card_number | string | Frequent flyer number |
| card_expiry | date | Card expiry date (YYYY-MM-DD) |
| is_preferred | boolean | Whether this is the preferred card |
| is_active | boolean | Whether this card is active |
Error Responses
Client not found
{
"success": false,
"error": "Client not found",
"code": 404,
"timestamp": "2024-01-15T09:30:00+00:00"
}
Missing required parameter
{
"success": false,
"error": "Client ID required",
"code": 400,
"timestamp": "2024-01-15T09:30:00+00:00"
}
Authentication error
{
"success": false,
"error": "Missing X-Api-Token header",
"code": 401,
"timestamp": "2024-01-15T09:30:00+00:00"
}
Code Examples
JavaScript (Fetch)
const clientId = 123;
const response = await fetch(`/client/fetchOne/${clientId}`, {
headers: {
'X-Api-Token': 'your_api_token_here'
}
});
const data = await response.json();
if (data.success) {
const client = data.data;
console.log('Client:', client.first_name, client.last_name);
console.log('Phones:', client.contact.phones.length);
console.log('Emails:', client.contact.emails.length);
console.log('FF Cards:', client.frequent_flyer_cards.length);
}
PHP (cURL)
$clientId = 123;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "/client/fetchOne/{$clientId}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-Api-Token: your_api_token_here'
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
if ($data['success']) {
$client = $data['data'];
echo "Client: " . $client['first_name'] . " " . $client['last_name'] . "\n";
echo "Emails: " . count($client['contact']['emails']) . "\n";
echo "Phones: " . count($client['contact']['phones']) . "\n";
}
Python (requests)
import requests
client_id = 123
headers = {'X-Api-Token': 'your_api_token_here'}
response = requests.get(f'/client/fetchOne/{client_id}', headers=headers)
data = response.json()
if data['success']:
client = data['data']
print(f"Client: {client['first_name']} {client['last_name']}")
print(f"Emails: {len(client['contact']['emails'])}")
print(f"Phones: {len(client['contact']['phones'])}")
print(f"FF Cards: {len(client['frequent_flyer_cards'])}")