AOTG API: General Account Lookup: Difference between revisions

no edit summary
(Created page with "{{DRAFT}} <br/> {{Template:SeeAlsoAOTGApi}} <br/> Category:Programmer Category:AOTGApi Category:Integrate {{NavigateDeveloper}}")
 
No edit summary
Line 1:
==General Account Lookup==
{{DRAFT}}
Get a list of GL Account. It does not include debtor and creditor accounts.
{{AOTGApiMethodsSpec|GET|/api/Lookup/GeneralAccountLookup|Params=None}}
<br/>
==Code Snippets==
*Add header of '''"SOTC_AUTH"''', and assign value of '''AccessToken'''.
<br/>
{{AOTGApiCodeSnippetTab
|Python=
<syntaxhighlight lang="Python">
import requests
 
url = "http://aotg.cloud:8080/api/Lookup/GeneralAccountLookup"
 
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)
 
print(response.text)
</syntaxhighlight>
|PHPHttp=
<syntaxhighlight lang="PHP">
<?php
 
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/Lookup/GeneralAccountLookup');
$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;
}
</syntaxhighlight>
|RestSharp=
<syntaxhighlight lang="C#">
var client = new RestClient("http://aotg.cloud:8080/api/Lookup/GeneralAccountLookup");
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);
</syntaxhighlight>
|PHPcURL=
<syntaxhighlight lang="PHP">
<?php
 
$curl = curl_init();
 
curl_setopt_array($curl, array(
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://aotg.cloud:8080/api/Lookup/GeneralAccountLookup",
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;
}
</syntaxhighlight>
}}
 
===Response===
====Response Successful HTTP Request====
200 OK
====Response Successful Body====
#Code: Account Code
#Description: Description of the account
#CurrencyCode: Currency code of the account
<syntaxhighlight lang="json-object">
[
{
"Code": "100-0000",
"Description": "CAPITAL",
"CurrencyCode": "MYR"
},
{
"Code": "150-0000",
"Description": "RETAINED EARNING",
"CurrencyCode": "MYR"
},
{
"Code": "151-0000",
"Description": "RESERVES",
"CurrencyCode": "MYR"
},
{
"Code": "200-2000",
"Description": "FURNITURES & FITTINGS",
"CurrencyCode": "MYR"
},
{
"Code": "200-2005",
"Description": "ACCUM. DEPRN. - FURNITURES & FITTINGS",
"CurrencyCode": "MYR"
}
]
</syntaxhighlight>