Difference between revisions of "AOTG API: Get List of Debtor"

From AutoCount Resource Center
Jump to navigation Jump to search
Line 1: Line 1:
 
==Get a list of Debtor==
 
Get all customers in account book.
 
{{AOTGApiMethodsSpec|GET|/api/public/v1/Debtor}}
 
==API Request Flow==
 
==API Request Flow==
 
[[File:AOTGApiRequestFlow.png|link=]]
 
[[File:AOTGApiRequestFlow.png|link=]]
Line 6: Line 9:
 
#:When the data is ready for retrieve, the '''Status''' is '''"Completed"'''.
 
#:When the data is ready for retrieve, the '''Status''' is '''"Completed"'''.
 
#[[AOTG_API:_Get_List_of_Debtor#Get_Data_.28Result.29|Use '''Result''' method to get data]]
 
#[[AOTG_API:_Get_List_of_Debtor#Get_Data_.28Result.29|Use '''Result''' method to get data]]
 
==Get a list of Debtor==
 
Get all customers in account book.
 
{{AOTGApiMethodsSpec|GET|/api/public/v1/Debtor}}
 
 
<br/>
 
<br/>
 
==Code Snippets==
 
==Code Snippets==

Revision as of 08:33, 27 February 2019

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: 

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

Code is not available


Response

Id and Name will be used to retrieve the 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 shows the data is ready for retrieve.

{
    "RequestId": "a8ccd53f-75d8-4c99-262f-6f6201e61b74",
    "Status": "Completed"
}


Get Data (Result)

Code Snippets

<?php

$request = new HttpRequest();
$request->setUrl('http://smeonthecloud.com: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

  • The Id can be used for DELETE and GET debtor record.
{
    "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
}
  • ResultJson holds the array of debtor(s).

Readable ResultJson

Click Expand to view the data in readable format.

[
  {
    "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


Go to menu

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