<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Debtor');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d',
'Content-Type' => 'application/json'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
AOTG API: Get List of Debtor
Get a list of Debtor
Get all customers in account book.
API Method
Http Method: GET
Method: /api/public/v1/Debtor
Content-Type: application/json
Parameters: None
API Request Flow
- Submit request for Debtor list
- Obtain Id and Name from the response
- To check if the requested data is ready, use the Id to check status [Optional]
- When the data is ready for retrieve, the Status is "Completed".
- Use Result method to get data
Code Snippets
- Add header of "SOTC_AUTH", and assign value of AccessToken.
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Debtor");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Debtor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Response
Response Successful HTTP Request
200 OK
Response Successful Body
Id and Name are required to retrieve result (data).
{
"Id": "a8ccd53f-75d8-4c99-262f-6f6201e61b74",
"Name": "GetDebtorList",
"StartTimestamp": "2019-02-26T09:35:30.6022302Z",
"EndTimestamp": "2019-02-26T09:35:30.6022302Z"
}
Check Status before Get Data
Code Snippets
<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/a8ccd53f-75d8-4c99-262f-6f6201e61b74');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/a8ccd53f-75d8-4c99-262f-6f6201e61b74");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
IRestResponse response = client.Execute(request);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/a8ccd53f-75d8-4c99-262f-6f6201e61b74",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Code is not available
Response Status
4 possible responses from process status.
InQueue status
- InQueue status Indicates that the requests to AOTG Server is waiting to be processed.
- Usually this happen when many requests are called to AOTG Web API in within a second.
- Make sure the request in the loop has pause time,
- or use 'batch' method to process multiple records in single request if applicable.
"RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74", "Status": "InQueue"
Processing status
- Processing status indicates that the request is not complete.
"RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74", "Status": "Processing"
Completed status
- Completed status Indicates that the request has been performed and succeeded.
"RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74", "Status": "Completed"
Failed status
- Failed status indicates that the request has been performed but has error.
"RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74", "Status": "Failed"
Get Data (Result)
Code Snippets
<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/GetDebtorList/a8ccd53f-75d8-4c99-262f-6f6201e61b74/result');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'SOTC_AUTH' => 'SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d',
'Content-Type' => 'application/json'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/GetDebtorList/a8ccd53f-75d8-4c99-262f-6f6201e61b74/result");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("SOTC_AUTH", "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/GetDebtorList/a8ccd53f-75d8-4c99-262f-6f6201e61b74/result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"SOTC_AUTH: SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Code is not available
Response From Result
Response Successful HTTP Request
200 OK
Response Successful Body
- The value "{[!MzAwLUEwMDE!]}" is the Id in ResultJson can be used for Update, DELETE and GET debtor record.
- ResultJson holds the array of debtor(s).
{
"RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74",
"RequestName": "GetDebtorList",
"HostName": "---",
"IPAddress": "---",
"RequestTypeName": "Debtor",
"ResultJson": "[{\"Id\":\"{[!MzAwLUEwMDE!]}\",\"AccNo\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"RegisterNo\":\"\",\"Description\":\"ABC CUSTOMER\",\"InvoiceAddress\":{\"Contact\":\"Mr.Tan\",\"Fax\":\"\",\"Phone\":\"02111373\",\"Address1\":\"1/2, PINE STREET,\",\"Address2\":\"CENTURY ROAD,\",\"Address3\":\"SELANGOR\",\"Address4\":\"50000 MALAYSIA\"},\"DeliverAddress\":{\"Contact\":\"Mr.Tan\",\"Fax\":\"\",\"Phone\":\"02111373\",\"Address1\":\"1/2, PINE STREET,\",\"Address2\":\"Delivery CENTURY ROAD,\",\"Address3\":\"SELANGOR\",\"Address4\":\"50000 MALAYSIA\"},\"SalesAgent\":\"\",\"CreditTerm\":\"C.O.D.\",\"CreditLimit\":30000.00,\"NatureOfBusiness\":\"\",\"WebURL\":\"\",\"EmailAddress\":\"\",\"Outstanding\":15650.00,\"IsActive\":true,
\"CurrencyCode\":\"MYR\",\"CurrencySymbol\":\"RM\",\"BlockExceedCreditLimit\":false,\"TaxCode\":\"\",\"TaxRegistrationNo\":null,\"IsTaxRegistered\":null,\"GSTStatusVerifiedDate\":null,\"IsInclusiveTax\":false,\"Area\":null,
\"PriceCategory\":null,\"DetailDiscount\":\"\",\"SalesExemptionNo\":\"\",\"SalesExemptionExpiryDate\":null,\"BranchList\":null,\"TaxExemptionList\":[]},{\"Id\":\"{[!MzAwLVUwMDE!]}\",\"AccNo\":\"300-U001\",\"CompanyName\":\"USD CUSTOMER\",
\"RegisterNo\":\"\",\"Description\":\"USD CUSTOMER\",\"InvoiceAddress\":{\"Contact\":\"\",\"Fax\":\"\",\"Phone\":\"\",\"Address1\":\"\",\"Address2\":\"\",\"Address3\":\"\",\"Address4\":\"\"},\"DeliverAddress\":{\"Contact\":\"\",\"Fax\":\"\",\"Phone\":\"\",\"Address1\":\"\",\"Address2\":\"\",\"Address3\":\"\",\"Address4\":\"\"},\"SalesAgent\":\"\",\"CreditTerm\":\"C.O.D.\",\"CreditLimit\":30000.00,\"NatureOfBusiness\":\"\",
\"WebURL\":\"\",\"EmailAddress\":\"\",\"Outstanding\":0.0,\"IsActive\":true,\"CurrencyCode\":\"USD\",\"CurrencySymbol\":\"USD\",\"BlockExceedCreditLimit\":false,\"TaxCode\":\"\",\"TaxRegistrationNo\":null,\"IsTaxRegistered\":null,
\"GSTStatusVerifiedDate\":null,\"IsInclusiveTax\":false,\"Area\":null,\"PriceCategory\":null,\"DetailDiscount\":\"\",\"SalesExemptionNo\":\"\",\"SalesExemptionExpiryDate\":null,\"BranchList\":null,\"TaxExemptionList\":[]},{\"Id\":\"{[!MzAwLVMwMDE!]}\",\"AccNo\":\"300-S001\",\"CompanyName\":\"SGD CUSTOMER\",\"RegisterNo\":\"\",\"Description\":\"SGD CUSTOMER\",\"InvoiceAddress\":{\"Contact\":\"\",\"Fax\":\"\",\"Phone\":\"\",\"Address1\":\"\",\"Address2\":\"\",\"Address3\":\"\",\"Address4\":\"\"},\"DeliverAddress\":{\"Contact\":\"\",\"Fax\":\"\",\"Phone\":\"\",\"Address1\":\"\",\"Address2\":\"\",\"Address3\":\"\",\"Address4\":\"\"},\"SalesAgent\":\"\",\"CreditTerm\":\"C.O.D.\",\"CreditLimit\":30000.00,\"NatureOfBusiness\":\"\",
\"WebURL\":\"\",\"EmailAddress\":\"\",\"Outstanding\":190.00,\"IsActive\":true,\"CurrencyCode\":\"SGD\",\"CurrencySymbol\":\"SGD\",\"BlockExceedCreditLimit\":false,\"TaxCode\":\"\",\"TaxRegistrationNo\":null,\"IsTaxRegistered\":null,
\"GSTStatusVerifiedDate\":null,\"IsInclusiveTax\":false,\"Area\":null,\"PriceCategory\":null,\"DetailDiscount\":\"\",\"SalesExemptionNo\":\"\",\"SalesExemptionExpiryDate\":null,\"BranchList\":null,\"TaxExemptionList\":[]}]",
"RequestParamJson": null,
"ResultStream": null,
"ResultTypeName": "System.Collections.Generic.List`1[PSW.SOTC.Accounting.Provider.Models.DebtorEntity]",
"Status": "Completed",
"Version": "1.2.19015.11001",
"AccountBookInfo": "Plug-In 1.9 Test;1.0.9.76",
"AccountBookDBInfo": "1.0.9.76",
"Timestamp": "2019-02-27T01:04:12.2388266Z",
"ResultedTimestamp": "2019-02-27T01:04:12.3078541Z",
"ProcessingInterval": 0.8328975,
"InQueueInterval": 1.3863336,
"ResultFileURL": null
}
Highlighted shows the Id of the debtor which is the identifier of the debtor that is generated by AOTG.
[
{
"Id": "{[!MzAwLUEwMDE!]}",
"AccNo": "300-A001",
"CompanyName": "ABC CUSTOMER",
"RegisterNo": "",
"Description": "ABC CUSTOMER",
"InvoiceAddress": {
"Contact": "Mr.Tan",
"Fax": "",
"Phone": "02111373",
"Address1": "1/2, PINE STREET,",
"Address2": "CENTURY ROAD,",
"Address3": "SELANGOR",
"Address4": "50000 MALAYSIA"
},
"DeliverAddress": {
"Contact": "Mr.Tan",
"Fax": "",
"Phone": "02111373",
"Address1": "1/2, PINE STREET,",
"Address2": "Delivery CENTURY ROAD,",
"Address3": "SELANGOR",
"Address4": "50000 MALAYSIA"
},
"SalesAgent": "",
"CreditTerm": "C.O.D.",
"CreditLimit": 30000,
"NatureOfBusiness": "",
"WebURL": "",
"EmailAddress": "",
"Outstanding": 15650,
"IsActive": true,
"CurrencyCode": "MYR",
"CurrencySymbol": "RM",
"BlockExceedCreditLimit": false,
"TaxCode": "",
"TaxRegistrationNo": null,
"IsTaxRegistered": null,
"GSTStatusVerifiedDate": null,
"IsInclusiveTax": false,
"Area": null,
"PriceCategory": null,
"DetailDiscount": "",
"SalesExemptionNo": "",
"SalesExemptionExpiryDate": null,
"BranchList": null,
"TaxExemptionList": []
},
{
"Id": "{[!MzAwLVUwMDE!]}",
"AccNo": "300-U001",
"CompanyName": "USD CUSTOMER",
"RegisterNo": "",
"Description": "USD CUSTOMER",
"InvoiceAddress": {
"Contact": "",
"Fax": "",
"Phone": "",
"Address1": "",
"Address2": "",
"Address3": "",
"Address4": ""
},
"DeliverAddress": {
"Contact": "",
"Fax": "",
"Phone": "",
"Address1": "",
"Address2": "",
"Address3": "",
"Address4": ""
},
"SalesAgent": "",
"CreditTerm": "C.O.D.",
"CreditLimit": 30000,
"NatureOfBusiness": "",
"WebURL": "",
"EmailAddress": "",
"Outstanding": 0,
"IsActive": true,
"CurrencyCode": "USD",
"CurrencySymbol": "USD",
"BlockExceedCreditLimit": false,
"TaxCode": "",
"TaxRegistrationNo": null,
"IsTaxRegistered": null,
"GSTStatusVerifiedDate": null,
"IsInclusiveTax": false,
"Area": null,
"PriceCategory": null,
"DetailDiscount": "",
"SalesExemptionNo": "",
"SalesExemptionExpiryDate": null,
"BranchList": null,
"TaxExemptionList": []
},
{
"Id": "{[!MzAwLVMwMDE!]}",
"AccNo": "300-S001",
"CompanyName": "SGD CUSTOMER",
"RegisterNo": "",
"Description": "SGD CUSTOMER",
"InvoiceAddress": {
"Contact": "",
"Fax": "",
"Phone": "",
"Address1": "",
"Address2": "",
"Address3": "",
"Address4": ""
},
"DeliverAddress": {
"Contact": "",
"Fax": "",
"Phone": "",
"Address1": "",
"Address2": "",
"Address3": "",
"Address4": ""
},
"SalesAgent": "",
"CreditTerm": "C.O.D.",
"CreditLimit": 30000,
"NatureOfBusiness": "",
"WebURL": "",
"EmailAddress": "",
"Outstanding": 190,
"IsActive": true,
"CurrencyCode": "SGD",
"CurrencySymbol": "SGD",
"BlockExceedCreditLimit": false,
"TaxCode": "",
"TaxRegistrationNo": null,
"IsTaxRegistered": null,
"GSTStatusVerifiedDate": null,
"IsInclusiveTax": false,
"Area": null,
"PriceCategory": null,
"DetailDiscount": "",
"SalesExemptionNo": "",
"SalesExemptionExpiryDate": null,
"BranchList": null,
"TaxExemptionList": []
}
]
See Also AOTG API
- Introduction to AOTG API
- Begin AutoCount Accounting Integration via AOTG API
- AOTG API Authenticate (Get AccessToken)
Debtor |
AR Invoice |
Item |
Create |
Update |
GL/AR/AP |
General |
![]() |
Go to top
|
![]() |
Resources For AutoCount Software Developers
|