AOTG API: Get Debtor

Revision as of 06:59, 1 March 2019 by DanielY (talk | contribs)

Draft

Get Debtor

Get the data of a debtor (customer).

  • debtorId is a unique identifier created in AOTG.
  • See Get List of Debtor on how to obtain Id (that is created in AOTG).

API Method

Http Method: GET
Method: /api/public/v1/Debtor/{debtorId} 
Content-Type: application/json
Parameters: 

API Request Flow

 

  1. Submit GetDebtor request for a debtor with an Id of the debtor
  2. Check the successful request status, if the data is completed (ready).
  3. Retrieve the data with Result method.

Code Snippets

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

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

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

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

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)


Response

  • Successful Response indicates GetDebtor has been performed.

Response Successful HTTP Request

200 OK

Response Successful Body

  • Id can be used to check the status of the data readiness.
  • Id and Name can be used to retrieve the debtor data.
{
    "Id": "7d472828-b1df-44fe-8a7b-1e737ca09ba5",
    "Name": "GetDebtor",
    "StartTimestamp": "2019-03-01T06:24:28.0847569Z",
    "EndTimestamp": "2019-03-01T06:24:28.0847569Z"
}

Check Status


See Also AOTG API


Go to menu

  Go to top
  Resources For AutoCount Software Developers