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

Description

Updates an existing customer record in your Solar Proof account. You must provide the customer ID (pkcustomerid) and can update any or all of the customer's information fields. Only the fields you include in the request will be updated; other fields will remain unchanged.

Partial Updates Supported: You don't need to send all fields - only include the fields you want to update. Other fields will retain their existing values.
Customer ID Required: You must know the customer's ID to update them. Use the Get Customer ID by Email endpoint first if you only have their email address.

Request Parameters

Authentication: Include your API key in the URL query string ?api_key=YOUR_API_KEY

Query Parameters

Parameter Type Required Description
api_key string Required Your Solar Proof API key
action string Required Must be set to "updatecustomer"

Request Body (JSON)

Send a JSON object in the request body with a data key containing the following fields:

Field Type Required Description
apikey string Required Your Solar Proof API key
action string Required Must be "updatecustomer"
pkcustomerid integer Required The unique ID of the customer to update
firstname string Optional Customer's first name
surname string Optional Customer's last name
email string Optional Customer's email address
phone1 string Optional Primary phone number
phone2 string Optional Secondary phone number
type string Optional Customer type: "RESIDENTIAL", "COMMERCIAL", or "LARGE-SCALE"
companyname string Optional Company name (for commercial customers)
companyphone string Optional Company phone number
gststatus integer Optional GST registration status: 1 = registered, 0 = not registered

Response

Success Response (200 OK)

Response Body JSON
{
  "Message": "Customer updated successfully!",
  "CustomerId": "79461"
}
Field Type Description
Message string Success message confirming the update
CustomerId string The ID of the updated customer

Error Response (4xx/5xx)

Error Response JSON
{
  "code": "CUSTOMER_NOT_FOUND",
  "message": "No customer exists with ID: 79461"
}
Error Code Description
INVALID_API_KEY The provided API key is invalid or missing
INVALID_PARAMETERS Required parameter pkcustomerid is missing or invalid
CUSTOMER_NOT_FOUND No customer exists with the specified ID
PERMISSION_DENIED You don't have permission to update this customer
UPDATE_FAILED Customer update failed due to a server error

Example Request

cURL bash
curl -X POST "https://solarproof.com.au/apidata.php?api_key=YOUR_API_KEY&action=updatecustomer" \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "apikey": "YOUR_API_KEY",
      "action": "updatecustomer",
      "pkcustomerid": 79461,
      "firstname": "John",
      "surname": "Smith",
      "phone1": "0412345678",
      "phone2": "0298765432",
      "email": "john.smith@example.com",
      "gststatus": 1,
      "companyname": "Smith Solar Solutions",
      "companyphone": "1300123456",
      "type": "RESIDENTIAL"
    }
  }'
JavaScript (Fetch) - Update Single Field javascript
const apiKey = 'YOUR_API_KEY';
const customerId = 79461;
const url = `https://solarproof.com.au/apidata.php?api_key=${apiKey}&action=updatecustomer`;

// Update only the phone number
const updateData = {
  data: {
    apikey: apiKey,
    action: 'updatecustomer',
    pkcustomerid: customerId,
    phone1: '0400999888'  // Only updating phone number
  }
};

fetch(url, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(updateData)
})
.then(response => response.json())
.then(data => {
  console.log('Update result:', data);
})
.catch(error => console.error('Error:', error));
PHP php
<?php
$apiKey = 'YOUR_API_KEY';
$customerId = 79461;
$url = "https://solarproof.com.au/apidata.php?api_key={$apiKey}&action=updatecustomer";

$data = [
    'data' => [
        'apikey' => $apiKey,
        'action' => 'updatecustomer',
        'pkcustomerid' => $customerId,
        'firstname' => 'John',
        'surname' => 'Smith',
        'phone1' => '0412345678',
        'email' => 'john.smith@example.com'
    ]
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$result = json_decode($response, true);

if ($httpCode === 200) {
    echo "Customer updated successfully: " . $result['CustomerId'];
} else {
    echo "Error: " . $result['message'];
}
?>
Python python
import requests
import json

api_key = 'YOUR_API_KEY'
customer_id = 79461
url = f'https://solarproof.com.au/apidata.php?api_key={api_key}&action=updatecustomer'

update_data = {
    'data': {
        'apikey': api_key,
        'action': 'updatecustomer',
        'pkcustomerid': customer_id,
        'firstname': 'John',
        'surname': 'Smith',
        'phone1': '0412345678',
        'email': 'john.smith@example.com'
    }
}

response = requests.post(
    url,
    headers={'Content-Type': 'application/json'},
    data=json.dumps(update_data)
)

if response.status_code == 200:
    result = response.json()
    print(f"Customer updated: {result['CustomerId']}")
else:
    print(f"Error: {response.status_code}")

Partial Update Example

You don't need to send all fields - only include what you want to update:

Update Only Email and Phone JSON
{
  "data": {
    "apikey": "YOUR_API_KEY",
    "action": "updatecustomer",
    "pkcustomerid": 79461,
    "email": "newemail@example.com",
    "phone1": "0400111222"
  }
}

// All other fields (firstname, surname, companyname, etc.) 
// will remain unchanged

Best Practices

Verify Before Updating

Use the Get Customer endpoint first to retrieve current values before updating. This helps prevent overwriting data accidentally.

Update Only What Changed

Only include fields that actually changed in your update request. This improves performance and makes audit logs clearer.

Email Changes Need Care

If you're changing a customer's email address, ensure it's unique and valid. Duplicate emails may cause issues.

Track Changes

Maintain your own audit log of customer updates in your application for compliance and troubleshooting purposes.

Related Endpoints

Related Webhook Event

customer_status_change

This webhook event is triggered when a customer's status is changed via the API or web interface