<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455');
$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;
}
AOTG API: Get AR Invoice: Difference between revisions
Content added Content deleted
(Created page with "==<DRAFT>== Incompleted! <br/><br/> ==Get AR Invoice== Get an AR Invoice from account book. {{AOTGApiMethodsSpec|GET|/api/public/v1/ARInvoice/GetARInvoice/{id}|Params=id<br/>...") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==<DRAFT>== |
|||
Incompleted! |
|||
<br/><br/> |
|||
==Get AR Invoice== |
==Get AR Invoice== |
||
Get an AR Invoice from account book. |
Get an AR Invoice from account book. |
||
Line 9: | Line 5: | ||
==API Request Flow== |
==API Request Flow== |
||
[[File:AOTGApiRequestFlow.png|link=]] |
[[File:AOTGApiRequestFlow.png|link=]] |
||
#Submit GetARInvoice request to retrieve one AR Invoice in account book. |
#Submit GetARInvoice request to retrieve one AR Invoice in account book with Id. |
||
#Check the successful request status, if the data is completed (ready). |
#Check the successful request status, if the data is completed (ready). |
||
#Retrieve the data with '''Result method'''. |
#Retrieve the data with '''Result method'''. |
||
Line 16: | Line 12: | ||
==Code Snippets== |
==Code Snippets== |
||
*Add header of '''"SOTC_AUTH"''', and assign value of '''AccessToken'''. |
*Add header of '''"SOTC_AUTH"''', and assign value of '''AccessToken'''. |
||
*'''1455''' is the Id that can be obtained with [[AOTG API: Get List of AR Invoice]], or after [[AOTG API: Create AR Invoice]] |
|||
<br/> |
<br/> |
||
{{AOTGApiCodeSnippetTab |
{{AOTGApiCodeSnippetTab |
||
|Python= |
|Python= |
||
<syntaxhighlight lang="Python"> |
<syntaxhighlight lang="Python"> |
||
import requests |
|||
url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455" |
|||
payload = "" |
|||
headers = { |
|||
'Content-Type': "application/json", |
|||
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d", |
|||
'cache-control': "no-cache" |
|||
} |
|||
response = requests.request("GET", url, data=payload, headers=headers) |
|||
print(response.text) |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
|PHPHttp= |
|PHPHttp= |
||
<syntaxhighlight lang="PHP"> |
<syntaxhighlight lang="PHP"> |
||
<?php |
|||
$request = new HttpRequest(); |
|||
$request->setUrl('http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455'); |
|||
$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; |
|||
} |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
|RestSharp= |
|RestSharp= |
||
<syntaxhighlight lang="C#"> |
<syntaxhighlight lang="C#"> |
||
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455"); |
|||
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); |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
|PHPcURL= |
|PHPcURL= |
||
<syntaxhighlight lang="PHP"> |
<syntaxhighlight lang="PHP"> |
||
<?php |
|||
$curl = curl_init(); |
|||
curl_setopt_array($curl, array( |
|||
CURLOPT_PORT => "8080", |
|||
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455", |
|||
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; |
|||
} |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
}} |
}} |
||
=== |
===Response=== |
||
====Response Successful HTTP Request==== |
====Response Successful HTTP Request==== |
||
200 OK |
200 OK |
||
====Response Successful Body==== |
====Response Successful Body==== |
||
'''Id''' can be used for checking the status of result. |
|||
'''Id''' and '''Name''' are required to retrieve result (data). |
|||
<syntaxhighlight lang="json-object" highlight="2,3"> |
<syntaxhighlight lang="json-object" highlight="2,3"> |
||
{ |
|||
"Id": "t590eef-2337b-562f-8990-803cbc0b48636", |
|||
"Name": "GetARInvoice", |
|||
"StartTimestamp": "2019-03-05T01:39:20.7232199Z", |
|||
"EndTimestamp": "2019-03-05T01:39:20.7232199Z" |
|||
} |
|||
</syntaxhighlight> |
|||
<br/> |
|||
==Check Status== |
|||
===Code Snippets=== |
|||
{{AOTGApiCodeSnippetTab |
|||
|Python= |
|||
<syntaxhighlight lang="Python"> |
|||
import requests |
|||
url = "http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636" |
|||
payload = "" |
|||
headers = { |
|||
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d", |
|||
'cache-control': "no-cache" |
|||
} |
|||
response = requests.request("GET", url, data=payload, headers=headers) |
|||
print(response.text) |
|||
</syntaxhighlight> |
</syntaxhighlight> |
||
|PHPHttp= |
|||
<syntaxhighlight lang="PHP"> |
|||
<?php |
|||
$request = new HttpRequest(); |
|||
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636'); |
|||
$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; |
|||
} |
|||
</syntaxhighlight> |
|||
|RestSharp= |
|||
<syntaxhighlight lang="C#"> |
|||
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636"); |
|||
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); |
|||
</syntaxhighlight> |
|||
|PHPcURL= |
|||
<syntaxhighlight lang="PHP"> |
|||
<?php |
|||
$curl = curl_init(); |
|||
curl_setopt_array($curl, array( |
|||
CURLOPT_PORT => "8080", |
|||
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636", |
|||
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; |
|||
} |
|||
</syntaxhighlight> |
|||
}} |
|||
====Response Status==== |
|||
{{AOTGResponseStatus|t590eef-2337b-562f-8990-803cbc0b48636}} |
|||
<br/> |
|||
==Get Data (Result)== |
|||
===Code Snippets=== |
|||
{{AOTGApiCodeSnippetTab |
|||
|Python= |
|||
<syntaxhighlight lang="Python"> |
|||
import requests |
|||
url = "http://aotg.cloud:8080/api/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result" |
|||
payload = "" |
|||
headers = { |
|||
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d", |
|||
'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/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result'); |
|||
$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; |
|||
} |
|||
</syntaxhighlight> |
|||
|RestSharp= |
|||
<syntaxhighlight lang="C#"> |
|||
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result"); |
|||
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); |
|||
</syntaxhighlight> |
|||
|PHPcURL= |
|||
<syntaxhighlight lang="PHP"> |
|||
<?php |
|||
$curl = curl_init(); |
|||
curl_setopt_array($curl, array( |
|||
CURLOPT_PORT => "8080", |
|||
CURLOPT_URL => "http://aotg.cloud:8080/api/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/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( |
|||
"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; |
|||
} |
|||
</syntaxhighlight> |
|||
}} |
|||
====Response Successful HTTP Request==== |
|||
200 OK |
|||
====Response Successful Body==== |
|||
<tabber> |
|||
Body= |
|||
<syntaxhighlight lang="json-object"> |
|||
{ |
|||
"RequestId": "t590eef-2337b-562f-8990-803cbc0b48636", |
|||
"RequestName": "GetARInvoice", |
|||
"HostName": "---", |
|||
"IPAddress": "---", |
|||
"RequestTypeName": "ARInvoice", |
|||
"ResultJson": "{\"DebtorCode\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"Description\":\"AOTG IMPORT TEST A\",\"DocDate\":\"2019-03-03T00:00:00\",\"JournalType\":\"SALES\",\"DueDate\":\"2019-04-02T00:00:00\",\"DocNo\":\"I-000046\",\"LocalAmount\":0.00,\"TaxableAmount\":322.73,\"OutstandingAmount\":355.00,\"CurrencyCode\":\"MYR\",\"Agent\":\"TOM\",\"SourceType\":\"\",\"SourceKey\":\"\",\"CurrencyRate\":1.000000000000,\"Id\":\"1455\",\"RefNo2\":\"AOTG Web API\",\"CreditTerm\":\"Net 30 days\",\"InclusiveTax\":true,\"Note\":\"\",\"Total\":0.0,\"Amount\":355.00,\"TaxAmount\":32.27,\"DetailsLine\":[{\"Id\":\"1456\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 1\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":350.00,\"TaxRate\":10.000000,\"TaxAmount\":31.82,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":318.18,\"TaxableAmount\":350.00,\"LocalTaxAmount\":31.82,\"LocalSubTotal\":318.18,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":350.00,\"NetAmount\":350.00,\"LocalNetAmount\":350.00},{\"Id\":\"1457\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 2\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":5.00,\"TaxRate\":10.000000,\"TaxAmount\":0.45,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":4.55,\"TaxableAmount\":5.00,\"LocalTaxAmount\":0.45,\"LocalSubTotal\":4.55,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":5.00,\"NetAmount\":5.00,\"LocalNetAmount\":5.00}]}", |
|||
"RequestParamJson": null, |
|||
"ResultStream": null, |
|||
"ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ARInvoiceEntity", |
|||
"Status": "Completed", |
|||
"Version": "1.2.19051.12002", |
|||
"AccountBookInfo": "Plug-In 1.9 Test;1.0.9.77", |
|||
"AccountBookDBInfo": "1.0.9.77", |
|||
"Timestamp": "2019-03-05T05:49:53.5829933Z", |
|||
"ResultedTimestamp": "2019-03-05T05:49:53.6676613Z", |
|||
"ProcessingInterval": 2.8059105, |
|||
"InQueueInterval": 1.0500045, |
|||
"ResultFileURL": null |
|||
} |
|||
</syntaxhighlight> |
|||
|-| |
|||
Readable of ResultJson= |
|||
<syntaxhighlight lang="json-object"> |
|||
{ |
|||
"DebtorCode": "300-A001", |
|||
"CompanyName": "ABC CUSTOMER", |
|||
"Description": "AOTG IMPORT TEST A", |
|||
"DocDate": "2019-03-03T00:00:00", |
|||
"JournalType": "SALES", |
|||
"DueDate": "2019-04-02T00:00:00", |
|||
"DocNo": "I-000046", |
|||
"LocalAmount": 0, |
|||
"TaxableAmount": 322.73, |
|||
"OutstandingAmount": 355, |
|||
"CurrencyCode": "MYR", |
|||
"Agent": "TOM", |
|||
"SourceType": "", |
|||
"SourceKey": "", |
|||
"CurrencyRate": 1, |
|||
"Id": "1455", |
|||
"RefNo2": "AOTG Web API", |
|||
"CreditTerm": "Net 30 days", |
|||
"InclusiveTax": true, |
|||
"Note": "", |
|||
"Total": 0, |
|||
"Amount": 355, |
|||
"TaxAmount": 32.27, |
|||
"DetailsLine": [ |
|||
{ |
|||
"Id": "1456", |
|||
"LineState": 0, |
|||
"AccNo": "500-0000", |
|||
"Description": "AOTG Sales Detail 1", |
|||
"Project": "", |
|||
"Dept": "", |
|||
"Tax": "S-10", |
|||
"Amount": 350, |
|||
"TaxRate": 10, |
|||
"TaxAmount": 31.82, |
|||
"TaxAdjustment": 0, |
|||
"LocalTaxAdjustment": 0, |
|||
"SubTotal": 318.18, |
|||
"TaxableAmount": 350, |
|||
"LocalTaxAmount": 31.82, |
|||
"LocalSubTotal": 318.18, |
|||
"ToAccountRate": 1, |
|||
"LocalTaxableAmount": 350, |
|||
"NetAmount": 350, |
|||
"LocalNetAmount": 350 |
|||
}, |
|||
{ |
|||
"Id": "1457", |
|||
"LineState": 0, |
|||
"AccNo": "500-0000", |
|||
"Description": "AOTG Sales Detail 2", |
|||
"Project": "", |
|||
"Dept": "", |
|||
"Tax": "S-10", |
|||
"Amount": 5, |
|||
"TaxRate": 10, |
|||
"TaxAmount": 0.45, |
|||
"TaxAdjustment": 0, |
|||
"LocalTaxAdjustment": 0, |
|||
"SubTotal": 4.55, |
|||
"TaxableAmount": 5, |
|||
"LocalTaxAmount": 0.45, |
|||
"LocalSubTotal": 4.55, |
|||
"ToAccountRate": 1, |
|||
"LocalTaxableAmount": 5, |
|||
"NetAmount": 5, |
|||
"LocalNetAmount": 5 |
|||
} |
|||
] |
|||
} |
|||
</syntaxhighlight> |
|||
</tabber> |
|||
<br/> |
<br/> |
Latest revision as of 04:43, 28 March 2019
Get AR Invoice
Get an AR Invoice from account book.
API Method
Http Method: GET
Method: /api/public/v1/ARInvoice/GetARInvoice/{id}
Content-Type: application/json
Parameters: id
Id of the AR Invoice
API Request Flow
- Submit GetARInvoice request to retrieve one AR Invoice in account book with Id.
- Check the successful request status, if the data is completed (ready).
- Retrieve the data with Result method.
Code Snippets
- Add header of "SOTC_AUTH", and assign value of AccessToken.
- 1455 is the Id that can be obtained with AOTG API: Get List of AR Invoice, or after AOTG API: Create AR Invoice
var client = new RestClient("http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455");
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/ARInvoice/GetARInvoice/1455",
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;
}
import requests
url = "http://aotg.cloud:8080/api/public/v1/ARInvoice/GetARInvoice/1455"
payload = ""
headers = {
'Content-Type': "application/json",
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
'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
Id can be used for checking the status of result. Id and Name are required to retrieve result (data).
{
"Id": "t590eef-2337b-562f-8990-803cbc0b48636",
"Name": "GetARInvoice",
"StartTimestamp": "2019-03-05T01:39:20.7232199Z",
"EndTimestamp": "2019-03-05T01:39:20.7232199Z"
}
Check Status
Code Snippets
<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636');
$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/t590eef-2337b-562f-8990-803cbc0b48636");
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/t590eef-2337b-562f-8990-803cbc0b48636",
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;
}
import requests
url = "http://aotg.cloud:8080/api/public/v1/Result/t590eef-2337b-562f-8990-803cbc0b48636"
payload = ""
headers = {
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
'cache-control': "no-cache"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
Response Status
4 possible responses from 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": t590eef-2337b-562f-8990-803cbc0b48636, "Status": "InQueue"
Processing status
- Processing status indicates that the request is not complete.
"RequestId": t590eef-2337b-562f-8990-803cbc0b48636, "Status": "Processing"
Completed status
- Completed status Indicates that the request has been performed and succeeded.
"RequestId": t590eef-2337b-562f-8990-803cbc0b48636, "Status": "Completed"
Failed status
- Failed status indicates that the request has been performed but has error.
"RequestId": t590eef-2337b-562f-8990-803cbc0b48636, "Status": "Failed"
Get Data (Result)
Code Snippets
<?php
$request = new HttpRequest();
$request->setUrl('http://aotg.cloud:8080/api/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result');
$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/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result");
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/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/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(
"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;
}
import requests
url = "http://aotg.cloud:8080/api/public/v1/Result/GetARInvoice/t590eef-2337b-562f-8990-803cbc0b48636/result"
payload = ""
headers = {
'SOTC_AUTH': "SAMc13a36d2-a139-e911-b8b3-000d3aa04f3d",
'cache-control': "no-cache"
}
response = requests.request("GET", url, data=payload, headers=headers)
print(response.text)
Response Successful HTTP Request
200 OK
Response Successful Body
{
"RequestId": "t590eef-2337b-562f-8990-803cbc0b48636",
"RequestName": "GetARInvoice",
"HostName": "---",
"IPAddress": "---",
"RequestTypeName": "ARInvoice",
"ResultJson": "{\"DebtorCode\":\"300-A001\",\"CompanyName\":\"ABC CUSTOMER\",\"Description\":\"AOTG IMPORT TEST A\",\"DocDate\":\"2019-03-03T00:00:00\",\"JournalType\":\"SALES\",\"DueDate\":\"2019-04-02T00:00:00\",\"DocNo\":\"I-000046\",\"LocalAmount\":0.00,\"TaxableAmount\":322.73,\"OutstandingAmount\":355.00,\"CurrencyCode\":\"MYR\",\"Agent\":\"TOM\",\"SourceType\":\"\",\"SourceKey\":\"\",\"CurrencyRate\":1.000000000000,\"Id\":\"1455\",\"RefNo2\":\"AOTG Web API\",\"CreditTerm\":\"Net 30 days\",\"InclusiveTax\":true,\"Note\":\"\",\"Total\":0.0,\"Amount\":355.00,\"TaxAmount\":32.27,\"DetailsLine\":[{\"Id\":\"1456\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 1\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":350.00,\"TaxRate\":10.000000,\"TaxAmount\":31.82,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":318.18,\"TaxableAmount\":350.00,\"LocalTaxAmount\":31.82,\"LocalSubTotal\":318.18,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":350.00,\"NetAmount\":350.00,\"LocalNetAmount\":350.00},{\"Id\":\"1457\",\"LineState\":0,\"AccNo\":\"500-0000\",\"Description\":\"AOTG Sales Detail 2\",\"Project\":\"\",\"Dept\":\"\",\"Tax\":\"S-10\",\"Amount\":5.00,\"TaxRate\":10.000000,\"TaxAmount\":0.45,\"TaxAdjustment\":0.00,\"LocalTaxAdjustment\":0.0,\"SubTotal\":4.55,\"TaxableAmount\":5.00,\"LocalTaxAmount\":0.45,\"LocalSubTotal\":4.55,\"ToAccountRate\":1.000000000000,\"LocalTaxableAmount\":5.00,\"NetAmount\":5.00,\"LocalNetAmount\":5.00}]}",
"RequestParamJson": null,
"ResultStream": null,
"ResultTypeName": "PSW.SOTC.Accounting.Provider.Models.ARInvoiceEntity",
"Status": "Completed",
"Version": "1.2.19051.12002",
"AccountBookInfo": "Plug-In 1.9 Test;1.0.9.77",
"AccountBookDBInfo": "1.0.9.77",
"Timestamp": "2019-03-05T05:49:53.5829933Z",
"ResultedTimestamp": "2019-03-05T05:49:53.6676613Z",
"ProcessingInterval": 2.8059105,
"InQueueInterval": 1.0500045,
"ResultFileURL": null
}
{
"DebtorCode": "300-A001",
"CompanyName": "ABC CUSTOMER",
"Description": "AOTG IMPORT TEST A",
"DocDate": "2019-03-03T00:00:00",
"JournalType": "SALES",
"DueDate": "2019-04-02T00:00:00",
"DocNo": "I-000046",
"LocalAmount": 0,
"TaxableAmount": 322.73,
"OutstandingAmount": 355,
"CurrencyCode": "MYR",
"Agent": "TOM",
"SourceType": "",
"SourceKey": "",
"CurrencyRate": 1,
"Id": "1455",
"RefNo2": "AOTG Web API",
"CreditTerm": "Net 30 days",
"InclusiveTax": true,
"Note": "",
"Total": 0,
"Amount": 355,
"TaxAmount": 32.27,
"DetailsLine": [
{
"Id": "1456",
"LineState": 0,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 1",
"Project": "",
"Dept": "",
"Tax": "S-10",
"Amount": 350,
"TaxRate": 10,
"TaxAmount": 31.82,
"TaxAdjustment": 0,
"LocalTaxAdjustment": 0,
"SubTotal": 318.18,
"TaxableAmount": 350,
"LocalTaxAmount": 31.82,
"LocalSubTotal": 318.18,
"ToAccountRate": 1,
"LocalTaxableAmount": 350,
"NetAmount": 350,
"LocalNetAmount": 350
},
{
"Id": "1457",
"LineState": 0,
"AccNo": "500-0000",
"Description": "AOTG Sales Detail 2",
"Project": "",
"Dept": "",
"Tax": "S-10",
"Amount": 5,
"TaxRate": 10,
"TaxAmount": 0.45,
"TaxAdjustment": 0,
"LocalTaxAdjustment": 0,
"SubTotal": 4.55,
"TaxableAmount": 5,
"LocalTaxAmount": 0.45,
"LocalSubTotal": 4.55,
"ToAccountRate": 1,
"LocalTaxableAmount": 5,
"NetAmount": 5,
"LocalNetAmount": 5
}
]
}
See Also AOTG API
- Introduction to AOTG API
- Begin AutoCount Accounting Integration via AOTG API
- AOTG API Authenticate (Get AccessToken)
Debtor |
AR Invoice |
Item |
Create |
Update |
GL/AR/AP |
General |
Go to top
|
Resources For AutoCount Software Developers
|