GET https://solarproof.com.au/apidata.php

Description

This endpoint retrieves customer details for a specific project. It's useful when you have a project ID and need to access the associated customer's contact information, company details, and site address. This is particularly helpful for workflows where you're processing projects and need customer context.

Quick Lookup: This endpoint provides a direct way to get customer data from a project ID without needing to first look up the customer ID.

Request Parameters

Query Parameters

Parameter Type Required Description
api_key string Required Your Solar Proof API key
action string Required Must be set to "getcustomerofproject"
project_id integer Required The ID of the project whose customer you want to retrieve

Response

Success Response (200 OK)

Response Body JSON
{
  "Message": "Customer details retrieved successfully!",
  "Customer": {
    "customerID": 79298,
    "uid": null,
    "gstRegistered": 0,
    "firstName": "Judy",
    "surname": "Matherson",
    "phone1": "61411549054",
    "phone2": "",
    "email": "judymatherson@gmail.com",
    "companyName": "Solar Proof",
    "companyPhone": "1300 602 452",
    "customerabn": null,
    "siteAddress": "132 Mono Drive, Brisbane, QLD, 4321",
    "note": "",
    "contactTime": null
  }
}

Response Fields

Field Type Description
Message string Success message
Customer object Customer details object (see below)

Customer Object Fields

Field Type Description
customerID integer Unique identifier for the customer
uid string Unique identifier (may be null)
gstRegistered integer GST registration status: 1 = registered, 0 = not registered
firstName string Customer's first name
surname string Customer's last name
phone1 string Primary phone number
phone2 string Secondary phone number (may be empty)
email string Customer's email address
companyName string Company name (for commercial customers)
companyPhone string Company phone number
customerabn string Australian Business Number (may be null)
siteAddress string Full site address for the project
note string Notes about the customer
contactTime string Best time to contact the customer (may be null)

Error Response (4xx/5xx)

Error Response JSON
{
  "code": "PROJECT_NOT_FOUND",
  "message": "No project exists with ID: 123"
}
Error Code Description
INVALID_API_KEY The provided API key is invalid or missing
INVALID_PARAMETERS Required parameter project_id is missing
PROJECT_NOT_FOUND No project exists with the specified ID
NO_CUSTOMER_ASSIGNED The project exists but has no customer assigned
UNAUTHORISED You don't have permission to access this project

Example Request

cURL bash
curl -X GET "https://solarproof.com.au/apidata.php?action=getcustomerofproject&project_id=2143&api_key=YOUR_API_KEY"
JavaScript (Fetch) javascript
const apiKey = 'YOUR_API_KEY';
const projectId = 2143;
const url = `https://solarproof.com.au/apidata.php?action=getcustomerofproject&project_id=${projectId}&api_key=${apiKey}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    const customer = data.Customer;
    console.log('Customer:', customer.firstName, customer.surname);
    console.log('Email:', customer.email);
    console.log('Phone:', customer.phone1);
    console.log('Site:', customer.siteAddress);
  })
  .catch(error => console.error('Error:', error));
PHP php
<?php
$apiKey = 'YOUR_API_KEY';
$projectId = 2143;
$url = "https://solarproof.com.au/apidata.php?action=getcustomerofproject&project_id={$projectId}&api_key={$apiKey}";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
$customer = $data['Customer'];

echo "Customer: {$customer['firstName']} {$customer['surname']}\n";
echo "Email: {$customer['email']}\n";
echo "Phone: {$customer['phone1']}\n";
echo "Company: {$customer['companyName']}\n";
?>
Python python
import requests

api_key = 'YOUR_API_KEY'
project_id = 2143

params = {
    'action': 'getcustomerofproject',
    'project_id': project_id,
    'api_key': api_key
}

response = requests.get('https://solarproof.com.au/apidata.php', params=params)
data = response.json()
customer = data['Customer']

print(f"Customer: {customer['firstName']} {customer['surname']}")
print(f"Email: {customer['email']}")
print(f"Phone: {customer['phone1']}")
print(f"Site: {customer['siteAddress']}")

Common Use Cases

Customer Communication

When processing a project, quickly retrieve customer contact details for follow-up calls, emails, or SMS notifications about proposal status.

Invoice Generation

Retrieve customer and site information needed for generating invoices or contracts when a project moves to the signed stage.

Installation Scheduling

Get customer details and site address for scheduling installation appointments and sending site visit confirmations.

Related Endpoints