2,743
edits
(17 intermediate revisions by the same user not shown) | |||
Line 1:
==Delete Debtor==
Delete a specific Debtor.<br/>
*'''debtorId''' is a unique identifier created in AOTG.
*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|DELETE|/api/public/v1/Debtor/{debtorId}
==API Request Flow==
[[File:AOTGApiCompleteOrFailFlow.png|link=]]
#Submit Delete request of a debtor with an Id of the debtor
#Check the successful request status, if the action is '''Completed''' or '''Failed'''.
#To get the failed reason, use RESULT method to retrieve the message of completed or failed.
==Code Snippets==
*Add header of '''"SOTC_AUTH"''', and assign value of '''AccessToken'''.
{{AOTGApiCodeSnippetTab
|PHPHttp=
Line 78 ⟶ 83:
200 OK
====Response Successful Body====
*'''Id''' and '''Name''' can be used to retrieve the status and reason of the failed status.
<syntaxhighlight lang="json-object" highlight="2,3">
{
Line 159 ⟶ 165:
}}
====Response Status====
<syntaxhighlight lang="json-object">▼
{▼
▲ "RequestId": "f0268032-c161-4548-a74a-adb7143274a6",
}▼
</syntaxhighlight>▼
<syntaxhighlight lang="json-object">▼
{▼
}▼
</syntaxhighlight>▼
==Use RESULT method to get the failed reason of DELETE request==
===Code Snippets===
{{AOTGApiCodeSnippetTab
|PHPHttp=
Line 246 ⟶ 235:
}}
<br/>
====Response Successful from HTTP RESULT====
200 OK
====Result of Failed reason====
=====Debtor record not found=====
<tabber>
Body=
<syntaxhighlight lang="json-object">
{
"RequestId": "
"RequestName": "DeleteDebtor",
"HostName": "---",
Line 272 ⟶ 264:
}
</syntaxhighlight>
|-|
Readable of ResultJson=
▲<syntaxhighlight lang="json-object">
▲{
"Message": "Debtor record not found (AccNo=300-A002).",
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
"Source": "PSW.SOTC.Accounting.Provider.Autocount"
▲}
▲</syntaxhighlight>
</tabber>
=====Account in use, can't delete debtor=====
<tabber>
Body=
<syntaxhighlight lang="json-object">
{
Line 296 ⟶ 300:
}
</syntaxhighlight>
|-|
Readable of ResultJson=
▲<syntaxhighlight lang="json-object">
▲{
"Message": "Account in use, can't delete debtor.",
"StackTrace": " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at PSW.SOTC.Accounting.InProcess.AppServiceDispatcher.<DispatchRequest>d__13.MoveNext()",
"Source": "PSW.SOTC.Accounting.Provider.Autocount"
▲}
▲</syntaxhighlight>
</tabber>
<br/>
|