Customer
This domain serves for requests for customer management.
Create Customer
POSTThis API call creates a new customer entry in the database. Finally returning an array containing the ID and number of the newly created customer.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be create |
Required |
object data |
Contains input parameters. | Required |
string c_contact_name |
The contact name of the customer. | Required |
string c_name_1 |
The first part of the customer name. | Required |
string c_name_2 |
The second part of the customer name. | Optional |
string c_address_1 |
The first line of the customer's address. | Required |
string c_address_2 |
The second line of the customer's address. | Optional |
string c_suburb |
The suburb of the customer's address. | Required |
string c_postcode |
The postcode of the customer's address. | Required |
string c_email |
The email address of the customer. | Required |
string c_phone |
The phone number of the customer. | Required |
string c_mobile |
The mobile number of the customer. | Required |
int c_discount |
The discount percentage for the customer. | Optional |
string c_method |
The method of interaction with the customer (e.g., online, offline). | Required |
string c_notes |
Any notes related to the customer. | Optional |
Sample Request Body
{
domain: "customer",
action: "create",
data: {
c_contact_name: "John Doe",
c_name_1: "TEST ABC",
c_name_2: "Department XYZ",
c_address_1: "123 Main Street",
c_address_2: "Apt 456",
c_suburb: "Anytown",
c_postcode: "12345",
c_email: "john.doe@example.com",
c_phone: "123-456-7890",
c_mobile: "987-654-3210",
c_discount: 0,
c_method: "online",
c_notes: "Some notes about the customer"
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
object data |
This contain result data object of the API call. |
string id |
Created customers's ID |
string no |
Created customers's Customer Number |
Sample Response
{
status: "success",
data: {
status: "success",
message: "Customer Created",
data: {
id: 78,
no: "C240048"
}
}
}
Update Customer
POSTUpdates the details of an existing customer in the database. This function updates the specified customer's information in the database with the provided details.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be update |
Required |
object data |
Contains input parameters. | Required |
int customer_id |
ID of the customer to be updated. | Required |
string c_contact_name |
Contact name of the customer. | Required |
string c_name_1 |
First name or business name of the customer. | Required |
string c_name_2 |
Second name or department of the customer. | Optional |
string c_address_1 |
Primary address line of the customer. | Required |
string c_address_2 |
Secondary address line of the customer. | Optional |
string c_suburb |
Suburb of the customer. | Required |
string c_postcode |
Postcode of the customer. | Required |
string c_email |
Email address of the customer. | Required |
string c_phone |
Phone number of the customer. | Required |
string c_mobile |
Mobile number of the customer. | Required |
int c_discount |
Discount value for the customer. | Optional |
string c_method |
Method of customer interaction. | Required |
string c_notes |
Notes regarding the customer. | Optional |
Sample Request Body
{
domain: "customer",
action: "update",
data: {
customer_id: 75,
c_contact_name: "John DoeUPD",
c_name_1: "TEST ABC UPDATED",
c_name_2: "Department XYZ UPDATED",
c_address_1: "123 Main Street",
c_address_2: "Apt 456",
c_suburb: "Anytown Updated",
c_postcode: "12345",
c_email: "john.doe@example.com",
c_phone: "123-456-7890",
c_mobile: "987-654-3210",
c_discount: 0,
c_method: "online",
c_notes: "Some notes about the UPDATE"
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
object data |
This contain result data object of the API call. |
int data |
Number of affected records. expeted: 1 |
Sample Response
{
status: "success",
data: {
status: "success",
message: "Customer Updated",
data: 1
}
}
Read Customer
POSTRetrieves the details of a specific customer from the database based on the provided customer ID. If the customer is found, it returns the customer's details; otherwise, it returns a message indicating that no data was found.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be read |
Required |
object data |
Contains input parameters. | Required |
int customer_id |
ID of the customer to be retrieved. | Required |
Sample Request Body
{
domain: "customer",
action: "read",
data: {
customer_id: 75
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
object data |
This contain result data object of the API call. |
int id |
The unique identifier for the customer record. |
string customer_no |
The customer number associated with the customer. |
string c_contact_name |
The contact name of the customer. |
string c_name_1 |
The first part of the customer name. |
string c_name_2 |
The second part of the customer name. |
string c_address_1 |
The first line of the customer's address. |
string c_address_2 |
The second line of the customer's address. |
string c_suburb |
The suburb of the customer's address. |
string c_postcode |
The postcode of the customer's address. |
string c_email |
The email address of the customer. |
string c_phone |
The phone number of the customer. |
string c_mobile |
The mobile number of the customer. |
int c_discount |
The discount percentage for the customer. |
string c_method |
The method of interaction with the customer (e.g., online, offline). |
string c_notes |
Any notes related to the customer. |
string created_date |
The date and time when the customer record was created. |
string last_updated_by |
The name of the user who last updated the customer record. |
string last_updated_date |
The date and time when the customer record was last updated. |
string submitted_by |
The name of the user who submitted the customer record. |
int user_id |
The user ID associated with the customer record. |
Sample Response
{
status: "success",
data: {
id: 75,
customer_no: "C240048",
c_contact_name: "John Doe",
c_name_1: "TEST ABC",
c_name_2: "Department XYZ",
c_address_1: "123 Main Street",
c_address_2: "Apt 456",
c_suburb: "Anytown",
c_postcode: "12345",
c_email: "john.doe@example.com",
c_phone: "123-456-7890",
c_mobile: "987-654-3210",
c_discount: 0,
c_method: "online",
c_notes: "Some notes about the customer",
created_date: "2024-05-30 12:34:56",
last_updated_by: "Admin",
last_updated_date: "2024-05-30 12:34:56",
submitted_by: "Admin",
user_id: 69
}
}
Delete Customer
POSTThis action deletes customerDeletes a customer and all related data including quotes, quote attachments, and story attachments.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be delete |
Required |
object data |
Contains input parameters. | Required |
int user_id |
The ID of the user requesting the deletion. | Required |
int customer_id |
ID of the customer to be retrieved. | Required |
Sample Request Body
{
domain: "customer",
action: "delete",
data: {
user_id: 69,
customer_id: 75
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
object data |
This contain result data object of the API call. |
Sample Response
{
status: "success",
data: {
status: "success",
message: "Customer Deleted",
data: null
}
}
Read All Customers
POSTThis request is to get list of customes that maches to given filtersRetrieves a list of customers based on specified date range, if provided.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be read_all |
Required |
object data |
Contains input parameters. | Required |
string date_from |
The start date of the date range for filtering customers. | Optional |
string date_to |
The end date of the date range for filtering customers. | Optional |
Sample Request Body
{
domain: "customer",
action: "read_all",
data: {
date_from: "",
date_to: ""
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
list data |
This contain list of result data objects of the API call. |
string DT_RowId |
The ID of the row. |
string id |
The ID of the customer. |
string created_date |
The date when the customer was created. |
string c_contact_name |
The contact name of the customer. |
string customer_no |
The customer number. |
string c_name |
The concatenated first and last name of the customer. |
string c_name_1 |
The first name of the customer. |
string c_name_2 |
The last name of the customer. |
string c_address |
The concatenated address details of the customer. |
string c_address_1 |
The first line of the address. |
string c_address_2 |
The second line of the address. |
string c_suburb |
The suburb of the customer's address. |
string c_postcode |
The postcode of the customer's address. |
string c_method |
The method of communication with the customer. |
string c_notes |
Any notes associated with the customer. |
string c_email |
The email address of the customer. |
string c_phone |
The phone number of the customer. |
string c_mobile |
The mobile number of the customer. |
string lead_count |
The count of leads associated with the customer. |
string job_count |
The count of jobs associated with the customer. |
string po_count |
The count of purchase orders associated with the customer. |
string submitted_by |
The name of the user who submitted the customer. |
string submitted_user_id |
The ID of the user who submitted the customer. |
string assigned_staff |
The name of the staff assigned to the customer. |
integer delete_perm |
Indicates whether the current user has permission to delete the customer (1 for yes, 0 for no). |
Sample Response
{
"status": "success",
"data": {
"status": "success",
"message": "Customer Read all",
"data": {
"draw": 0,
"recordsTotal": 84,
"recordsFiltered": 84,
"data": [
{
"DT_RowId": "row_4",
"id": "4",
"created_date": "29 Feb 2024",
"c_contact_name": "John DoeUPD",
"customer_no": "C240004",
"c_name": "TEST ABC UPDATED Department XYZ UPDATED",
"c_name_1": "TEST ABC UPDATED",
"c_name_2": "Department XYZ UPDATED",
"c_address": "123 Main Street Apt 456 Anytown Updated 12345",
"c_address_1": "123 Main Street",
"c_address_2": "Apt 456",
"c_suburb": "Anytown Updated",
"c_postcode": "12345",
"c_method": "online",
"c_notes": "Some notes about the UPDATE",
"c_email": "john.doe@example.com",
"c_phone": "123-456-7890",
"c_mobile": "987-654-3210",
"lead_count": "4",
"job_count": "0",
"po_count": "0",
"submitted_by": "Madhawa",
"submitted_user_id": "8705",
"assigned_staff": " N/A",
"delete_perm": 1
},
]
}
}
}
Delete Customer
POSTThis action deletes customerDeletes a customer and all related data including quotes, quote attachments, and story attachments.
Request Paramters
string domain |
Value should be customer |
Required |
string action |
Value should be get_customer_names |
Required |
object data |
Contains input parameters. | Required |
int user_id |
The ID of the user requesting the data. | Required |
Sample Request Body
{
domain: "customer",
action: "get_customer_names",
data: {
user_id: 69
}
}
Response Paramters
string status |
This indicate the status of the response. success is the expected value. |
string message |
This explains the reson for status. |
list data |
This contain result data list of string customer names. |
Sample Response
{
status: "success",
data: {
status: "success",
message: "Customer Names Read",
data: [
"Jane",
"Jhon"
]
}
}