AOTG API: Get List of Debtor

From AutoCount Resource Center
Jump to navigation Jump to search

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

AOTGApiRequestFlow.png

  1. Submit request for Debtor list
    Obtain Id and Name from the response
  2. 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".
  3. Use Result method to get data


Code Snippets

  • Add header of "SOTC_AUTH", and assign value of AccessToken.


<?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;
}

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

Response Successful HTTP Request

200 OK


4 possible response body of the 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.

  1 [
  2   {
  3     "Id": "{[!MzAwLUEwMDE!]}",
  4     "AccNo": "300-A001",
  5     "CompanyName": "ABC CUSTOMER",
  6     "RegisterNo": "",
  7     "Description": "ABC CUSTOMER",
  8     "InvoiceAddress": {
  9       "Contact": "Mr.Tan",
 10       "Fax": "",
 11       "Phone": "02111373",
 12       "Address1": "1/2, PINE STREET,",
 13       "Address2": "CENTURY ROAD,",
 14       "Address3": "SELANGOR",
 15       "Address4": "50000 MALAYSIA"
 16     },
 17     "DeliverAddress": {
 18       "Contact": "Mr.Tan",
 19       "Fax": "",
 20       "Phone": "02111373",
 21       "Address1": "1/2, PINE STREET,",
 22       "Address2": "Delivery CENTURY ROAD,",
 23       "Address3": "SELANGOR",
 24       "Address4": "50000 MALAYSIA"
 25     },
 26     "SalesAgent": "",
 27     "CreditTerm": "C.O.D.",
 28     "CreditLimit": 30000,
 29     "NatureOfBusiness": "",
 30     "WebURL": "",
 31     "EmailAddress": "",
 32     "Outstanding": 15650,
 33     "IsActive": true,
 34     "CurrencyCode": "MYR",
 35     "CurrencySymbol": "RM",
 36     "BlockExceedCreditLimit": false,
 37     "TaxCode": "",
 38     "TaxRegistrationNo": null,
 39     "IsTaxRegistered": null,
 40     "GSTStatusVerifiedDate": null,
 41     "IsInclusiveTax": false,
 42     "Area": null,
 43     "PriceCategory": null,
 44     "DetailDiscount": "",
 45     "SalesExemptionNo": "",
 46     "SalesExemptionExpiryDate": null,
 47     "BranchList": null,
 48     "TaxExemptionList": []
 49   },
 50   {
 51     "Id": "{[!MzAwLVUwMDE!]}",
 52     "AccNo": "300-U001",
 53     "CompanyName": "USD CUSTOMER",
 54     "RegisterNo": "",
 55     "Description": "USD CUSTOMER",
 56     "InvoiceAddress": {
 57       "Contact": "",
 58       "Fax": "",
 59       "Phone": "",
 60       "Address1": "",
 61       "Address2": "",
 62       "Address3": "",
 63       "Address4": ""
 64     },
 65     "DeliverAddress": {
 66       "Contact": "",
 67       "Fax": "",
 68       "Phone": "",
 69       "Address1": "",
 70       "Address2": "",
 71       "Address3": "",
 72       "Address4": ""
 73     },
 74     "SalesAgent": "",
 75     "CreditTerm": "C.O.D.",
 76     "CreditLimit": 30000,
 77     "NatureOfBusiness": "",
 78     "WebURL": "",
 79     "EmailAddress": "",
 80     "Outstanding": 0,
 81     "IsActive": true,
 82     "CurrencyCode": "USD",
 83     "CurrencySymbol": "USD",
 84     "BlockExceedCreditLimit": false,
 85     "TaxCode": "",
 86     "TaxRegistrationNo": null,
 87     "IsTaxRegistered": null,
 88     "GSTStatusVerifiedDate": null,
 89     "IsInclusiveTax": false,
 90     "Area": null,
 91     "PriceCategory": null,
 92     "DetailDiscount": "",
 93     "SalesExemptionNo": "",
 94     "SalesExemptionExpiryDate": null,
 95     "BranchList": null,
 96     "TaxExemptionList": []
 97   },
 98   {
 99     "Id": "{[!MzAwLVMwMDE!]}",
100     "AccNo": "300-S001",
101     "CompanyName": "SGD CUSTOMER",
102     "RegisterNo": "",
103     "Description": "SGD CUSTOMER",
104     "InvoiceAddress": {
105       "Contact": "",
106       "Fax": "",
107       "Phone": "",
108       "Address1": "",
109       "Address2": "",
110       "Address3": "",
111       "Address4": ""
112     },
113     "DeliverAddress": {
114       "Contact": "",
115       "Fax": "",
116       "Phone": "",
117       "Address1": "",
118       "Address2": "",
119       "Address3": "",
120       "Address4": ""
121     },
122     "SalesAgent": "",
123     "CreditTerm": "C.O.D.",
124     "CreditLimit": 30000,
125     "NatureOfBusiness": "",
126     "WebURL": "",
127     "EmailAddress": "",
128     "Outstanding": 190,
129     "IsActive": true,
130     "CurrencyCode": "SGD",
131     "CurrencySymbol": "SGD",
132     "BlockExceedCreditLimit": false,
133     "TaxCode": "",
134     "TaxRegistrationNo": null,
135     "IsTaxRegistered": null,
136     "GSTStatusVerifiedDate": null,
137     "IsInclusiveTax": false,
138     "Area": null,
139     "PriceCategory": null,
140     "DetailDiscount": "",
141     "SalesExemptionNo": "",
142     "SalesExemptionExpiryDate": null,
143     "BranchList": null,
144     "TaxExemptionList": []
145   }
146 ]


See Also AOTG API


Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers