Create, Read, Update, and Delete (CRUD) Customer
This example shows you how to:
- Create a customer
- Read a customer
- Update a customer
- Delete a customer
- You have downloaded or cloned the Sage Intacct SDK for PHP examples.
- You successfully ran the getting started example—in particular, you set up the
.credentials.inifile required by
- The user you are using has add, edit, delete, list, and view permissions for the customer object.
Run the example
Observe the terminal output.
Information is echoed for each customer API function executed:
Created inactive customer ID 10066 Updated customer ID 10066 to active Read customer ID 10066 Deleted customer ID 10066 Process finished with exit code 0
Open the generated
logs/intacct.htmlfile in your browser and review the entries.
The file provides info and debug entries. The SDK provides a debug entry for each HTTP request/response (with the Sage Intacct endpoint).
Note that the log file was created by the HTML logger set in the client config.
Get a customer by name
ReadByNamefunction (instead of
$readByName = new ReadByName(); $readByName->setObjectName('CUSTOMER'); $readByName->setFields([ 'RECORDNO', 'CUSTOMERID', 'STATUS', ]); $readByName->setNames([ $customerId, ]); $response = $client->execute($readByName); echo "Read customer ID $customerId using ReadByName" . PHP_EOL;
Try a different object
- Try a different object’s CRUD functions from the
- Try an example that implements the
FunctionInterfacefor use with a custom object.
- Browse the reference documentation for the SDK.