Jump to content

AOTG API: Get Debtor: Difference between revisions

no edit summary
(Created page with "==Draft== ==Get Debtor== Get the data of a debtor (customer). *'''debtorId''' is a unique identifier created in AOTG. *See AOTG API: Get List of Debtor#Response_From_Resul...")
 
No edit summary
Line 7:
*See [[AOTG API: Get List of Debtor#Response_From_Result|Get List of Debtor]] on how to obtain '''Id''' (that is created in AOTG).
{{AOTGApiMethodsSpec|GET|/api/public/v1/Debtor/{debtorId} }}
 
==API Request Flow==
[[File:AOTGApiRequestFlow.png|link=]]
#Submit GetDebtor request for a debtor with an Id of the debtor
#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'''.
{{AOTGApiCodeSnippetTab
|Python=
<syntaxhighlight lang="json-objectPython">
import requests
 
url = "http://aotg.cloud:8080/api/public/v1/Debtor/{[%21MzAwLUEwMDI%21]}"
 
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/Debtor/{[%21MzAwLUEwMDI%21]}');
$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/Debtor/{[%21MzAwLUEwMDI%21]}");
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/Debtor/{[%21MzAwLUEwMDI%21]}",
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>
}}
Line 28 ⟶ 101:
200 OK
====Response Successful Body====
*'''Id''' and '''Name''' can be used to retrievecheck the status and reason of the faileddata statusreadiness.
*'''Id''' and '''Name''' can be used to retrieve the debtor data.
<syntaxhighlight lang="json-object">
<syntaxhighlight lang="json-object" highlight="2,3">
 
{
"Id": "7d472828-b1df-44fe-8a7b-1e737ca09ba5",
"Name": "GetDebtor",
"StartTimestamp": "2019-03-01T06:24:28.0847569Z",
"EndTimestamp": "2019-03-01T06:24:28.0847569Z"
}
</syntaxhighlight>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.