Quick Start Guide
Get up and running with the Solar Proof API in minutes. This guide will walk you through making your first API call and integrating with your application.
Get Your API Key
First, you'll need an API key to authenticate your requests. This unique key identifies your account and grants access to your data.
- Log into your Solar Proof account at solarproof.com.au
- Navigate to Settings → API Access
- Click "Generate API Key"
- Copy your API key and store it securely
Make Your First Request
Let's fetch all customers from your account. This is a simple GET request that requires only your API key.
Using cURL (Command Line)
curl "https://solarproof.com.au/apidata.php?action=getallcustomers&api_key=YOUR_API_KEY"
Using JavaScript (Node.js or Browser)
const apiKey = 'YOUR_API_KEY';
fetch(`https://solarproof.com.au/apidata.php?action=getallcustomers&api_key=${apiKey}`)
.then(response => response.json())
.then(data => {
console.log('Success!', data);
console.log(`Found ${data.length} customers`);
})
.catch(error => console.error('Error:', error));
Using Python
import requests
api_key = 'YOUR_API_KEY'
url = f'https://solarproof.com.au/apidata.php?action=getallcustomers&api_key={api_key}'
response = requests.get(url)
data = response.json()
print(f"Success! Found {len(data)} customers")
print(data)
Using PHP
<?php
$api_key = 'YOUR_API_KEY';
$url = "https://solarproof.com.au/apidata.php?action=getallcustomers&api_key={$api_key}";
$response = file_get_contents($url);
$data = json_decode($response, true);
echo "Success! Found " . count($data) . " customers\n";
print_r($data);
?>
Expected Response
You should receive a JSON array containing your customers. Each customer object includes fields like pkcustomerid
, customer_email
, customer_name
, and more.
Create a New Customer
Now let's create a customer using a POST request. This demonstrates how to send data to the API.
Using cURL
curl -X POST "https://solarproof.com.au/apidata.php?action=createcustomer&api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {
"customer_email": "test@example.com",
"customer_name": "Test Customer",
"customer_type": "RESIDENTIAL",
"customer_phone": "0412345678"
}
}'
Using JavaScript
const apiKey = 'YOUR_API_KEY';
fetch(`https://solarproof.com.au/apidata.php?action=createcustomer&api_key=${apiKey}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
customer_email: 'test@example.com',
customer_name: 'Test Customer',
customer_type: 'RESIDENTIAL',
customer_phone: '0412345678'
}
})
})
.then(response => response.json())
.then(data => {
console.log('Customer created!', data);
})
.catch(error => console.error('Error:', error));
Expected Response
You'll receive a success message with the newly created customer's ID. You can now fetch this customer using the Get Customer endpoint.
Set Up Webhooks (Optional)
Webhooks let you receive real-time notifications when events occur in Solar Proof. This is perfect for keeping external systems in sync.
Subscribe to Customer Created Events
curl -X POST "https://solarproof.com.au/apidata.php?action=subscribe_customer&api_key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"hookUrl": "https://your-domain.com/webhooks/solarproof",
"type_request": "customer_created"
}'
When you create a new customer, Solar Proof will automatically send a POST request to your webhook URL with the customer data.
What's Next?
You've made your first API calls! Here are some next steps to continue building your integration:
Common Integration Patterns
Here are some popular ways developers use the Solar Proof API:
CRM Synchronization
Use webhooks to automatically sync new Solar Proof customers to your CRM (Salesforce, HubSpot, etc.) when they're created.
Custom Dashboards
Fetch customer and project data to build custom reporting dashboards with your preferred analytics tools.
Team Notifications
Subscribe to project and customer events to send real-time notifications to Slack, Teams, or email when important actions occur.
Workflow Automation
Build automated workflows that trigger actions in other systems based on Solar Proof events (e.g., create tasks when proposals are published).
Troubleshooting
Issue | Possible Cause | Solution |
---|---|---|
401 Unauthorized | Invalid or missing API key | Verify your API key is correct and included in the URL |
Empty response | No data matches your request | Check that you have customers/projects in your account |
CORS error (browser) | Making API calls from client-side JavaScript | Move API calls to your server to keep your API key secure |
Invalid JSON | Malformed request body | Validate your JSON syntax before sending POST requests |