Difference between revisions of "AOTG API: General Account Lookup"

From AutoCount Resource Center
Jump to navigation Jump to search
(Created page with "{{DRAFT}} <br/> {{Template:SeeAlsoAOTGApi}} <br/> Category:Programmer Category:AOTGApi Category:Integrate {{NavigateDeveloper}}")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
  +
==General Account Lookup==
{{DRAFT}}
 
  +
Get a list of GL Account. Result 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>
   
   

Latest revision as of 03:43, 18 March 2019

General Account Lookup

Get a list of GL Account. Result does not include debtor and creditor accounts.

API Method

Http Method: GET
Method: /api/Lookup/GeneralAccountLookup
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/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;
}

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

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

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)


Response

Response Successful HTTP Request

200 OK

Response Successful Body

  1. Code: Account Code
  2. Description: Description of the account
  3. CurrencyCode: Currency code of the account
[
    {
        "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"
    }
]



See Also AOTG API


Go to menu

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