Set invoice status#
This endpoint is used to set the different client status to a specific document.
Endpoint steps#
Get a token from your credentials by calling the endpoint Account/getToken;
Set the status by calling the endpoint InboundFinancialDocument/status.
Response structure from server#
When a request is well formed and the authentication data is correct the system responds with a message envelope as follows:
{
"CorrelationId": "<GUID>", /* for correlation purposes */
"IsValid": true, /* false in case of erros */
"Errors": [], /* if empty is a good signal */
"Data": "<Service Response Data>" /* the data retuned ex: token, invoice status, dependent on the endpoint called */
}
Endpoint Server Base URL#
# Test Environment
server_base_adress = "dcn-solution-qa.saphety.com/Dcn.Business.WebApi"
# Saphety Invoice Network - Production Environment
#server_base_adress = "dcn-solution.saphety.com/Dcn.Business.WebApi"
1. Get a token (Account/getToken)#
Get a token from your account credentials using endpoint api/Account/getToken
Check here how to obtain an authentication token.
2. Set the status directly by using the status endpoint (InboundFinancialDocument/status)#
The status available for the clients to set are:
ACCEPTED: this status can be mean different levels of integration, like, manual approval or automatic acceptance. This status or the rejected status are mandatory.
REJECTED: this status is used to reject the document. Can be a funcional or technical rejection. By rejecting a document the reason must be sent. This status or the accepted status are mandatory.
PAID: this status is optional, but recommended.
2.1 Request structure#
In the url you need to supply this parameter:
documentId#
Description: id associated with the legal document.
Required: Yes
Type: string
Example: “f1baf2fa-98d2-4284-9233-bc6c18a51087”
status#
Description: pretended status for the document.
Required: Yes
Type: string
Allowed values: “Accepted”, “Rejected”, “Paid”
Example: “Accepted”
reason#
Description: if status “rejected” must be indicated a reason.
Required: No (Yes if “Status” = “Rejected”)
Type: string
Example: “test reason for reject a document”
2.2 Request example#
2.2.1 Use case for the accepted status#
service_url = "https://" + server_base_adress + "/api/InboundFinancialDocument/status"
print ('Endpoint url: ' + service_url)
#headers
headers = {
'Content-Type': 'application/json',
'Authorization': 'bearer ' + token
}
# payload as json
payload = {
"Id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"Status": "Accepted"
}
request_data=json.dumps(payload)
Endpoint url: https://dcn-solution-qa.saphety.com/Dcn.Business.WebApi/api/InboundFinancialDocument/status
2.2.2 Use case for the rejected status#
service_url = "https://" + server_base_adress + "/api/InboundFinancialDocument/status"
print ('Endpoint url: ' + service_url)
#headers
headers = {
'Content-Type': 'application/json',
'Authorization': 'bearer ' + token
}
# payload as json
payload = {
"Id": "906FA7A0-A580-4E1D-81AC-8D9DF41EF367",
"Status": "Rejected",
"Reason": "Test reject document"
}
request_data=json.dumps(payload)
Endpoint url: https://dcn-solution-qa.saphety.com/Dcn.Business.WebApi/api/InboundFinancialDocument/status
2.3 Response example#
{
"CorrelationId": "8120bfbe-d8eb-4897-baab-6c6a0b39bcac",
"IsValid": true,
"Errors": [],
"Data": {}
}