AOTG API: Debtor Lookup

From AutoCount Resource Center
Revision as of 03:58, 18 March 2019 by DanielY (talk | contribs) (Created page with "==Debtor Lookup== Get a list of customer. {{AOTGApiMethodsSpec|GET|/api/public/v1/Lookup/DebtorLookup|Params=None}} <br/> ==Code Snippets== *Add header of '''"SOTC_AUTH"''', a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Debtor Lookup

Get a list of customer.

API Method

Http Method: GET
Method: /api/public/v1/Lookup/DebtorLookup
Content-Type: application/json
Parameters: None


Code Snippets

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


<?php

$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/Lookup/DebtorLookup');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'Content-Type' => 'application/json',
  'SOTC_AUTH' => 'SAMs1a36d2-a139-e911-b8b3-000aa03t3d'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

var client = new RestClient("http://aotg.cloud:8080/api/Lookup/DebtorLookup");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("SOTC_AUTH", "SAMs1a36d2-a139-e911-b8b3-000aa03t3d");
IRestResponse response = client.Execute(request);

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_PORT => "8080",
  CURLOPT_URL => "http://aotg.cloud:8080/api/Lookup/DebtorLookup",
  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: SAMs1a36d2-a139-e911-b8b3-000aa03t3d",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

import requests

url = "http://aotg.cloud:8080/api/Lookup/DebtorLookup"

payload = ""
headers = {
    'SOTC_AUTH': "SAMs1a36d2-a139-e911-b8b3-000aa03t3d",
    'Content-Type': "application/json",
    'cache-control': "no-cache"
    }

response = requests.request("GET", url, data=payload, headers=headers, params=querystring)

print(response.text)


Response

Response Successful HTTP Request

200 OK

Response Successful Body

  • Result contains of 2 debtors.
    1st debtor has more data than the 2nd debtor. As the 1st debtor has Branches.
[
    {
        "DataStructureVersion": 4,
        "AccNo": "300-A001",
        "CompanyName": "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.",
        "IsActive": true,
        "CurrencyCode": "MYR",
        "CurrencySymbol": "RM",
        "IsInclusiveTax": false,
        "TaxCode": "",
        "DetailDiscount": "",
        "SalesExemptionNo": "",
        "SalesExemptionExpiryDate": null,
        "BranchList": [
            {
                "IsActive": true,
                "Code": "B00A",
                "Name": "BRANCH A",
                "Address1": null,
                "Address2": null,
                "Address3": null,
                "Address4": null,
                "PostCode": null,
                "Contact": "",
                "Phone": "",
                "Phone2": null,
                "Fax1": null,
                "Fax2": null,
                "SalesAgent": null,
                "Area": null,
                "EmailAddress": null,
                "RowState": 0
            },
            {
                "IsActive": true,
                "Code": "B00B",
                "Name": "BRANCH B",
                "Address1": null,
                "Address2": null,
                "Address3": null,
                "Address4": null,
                "PostCode": null,
                "Contact": "",
                "Phone": "",
                "Phone2": null,
                "Fax1": null,
                "Fax2": null,
                "SalesAgent": null,
                "Area": null,
                "EmailAddress": null,
                "RowState": 0
            }
        ],
        "TaxExemptionList": []
    },
    {
        "DataStructureVersion": 4,
        "AccNo": "300-A002",
        "CompanyName": "AutoCount On The Go",
        "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.",
        "IsActive": true,
        "CurrencyCode": "MYR",
        "CurrencySymbol": "RM",
        "IsInclusiveTax": false,
        "TaxCode": "",
        "DetailDiscount": "",
        "SalesExemptionNo": "",
        "SalesExemptionExpiryDate": null,
        "BranchList": [],
        "TaxExemptionList": []
    }
]



See Also AOTG API


Go to menu

Go to top
Resources For AutoCount Software Developers