Get invoice permanent links#
This endpoint is used to get a permanent link to acess an invoice stored in archive.
Endpoint steps#
Get a token from your credentials by calling the endpoint Account/getToken;
Get document permalinks calling the endpoint OutboundFinancialDocument/getDocumentPermalinks/{documentId};
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#
# SANDBOX - Test Environment
server_base_adress = "dcn-solution.saphety.com/Dcn.Sandbox.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. Get invoice permalinks (OutboundFinancialDocument/getDocumentPermalinks/{documentId})#
2.1 Request structure#
In the endpoint url you need to supply the documentId received
documentId#
Description: You need to supply the id of the invoice.
Required: Yes
Type: string
Example: “3fa85f64-5717-4562-b3fc-2c963f66afa6”
2.2 Request example#
documentId = "e90e4213-7354-495c-bb60-cc08aff724f2"
# SIN endpoint url for retrieving inforfation on invoice previously sent
service_url = "https://" + server_base_adress + "/api/OutboundFinancialDocument/getDocumentPermalinks/" + documentId
print (service_url)
https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/OutboundFinancialDocument/getDocumentPermalinks/e90e4213-7354-495c-bb60-cc08aff724f2
2.3 Call the endpoint to get the document permalinks#
Get the invoice permanent link stored in archive by the Document id (“OutboundFinancialDocumentId“) using endpoint /api/OutboundFinancialDocument/getDocumentPermalinks/:documentId
headers = {
'Authorization': 'bearer ' + token
}
response = requests.request("GET", service_url, headers=headers)
# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response["Data"], indent=4))
{
"OutboundFinancialDocumentId": "e90e4213-7354-495c-bb60-cc08aff724f2",
"DocumentLink": "https://dcn-solution-qa.saphety.com/IN2.ContentStorage.WebApi/api/Content/false?token=48I6KL%2BWRL0kO07ENkKpPS%2FXL3d7ImN0SWQiOiJjMGNkNTFiZC00MjU3LTQwMjItOTc4ZC03OGY1MTBkZmE4MjEiLCJpRHQiOiIyMDIyLTExLTI5IiwiZUR0IjpudWxsLCJpQnkiOiJTYXBoZXR5IEFQSSBEZW1vIiwiaVRvIjoiU2FwaGV0eSBBUEkgRGVtbyIsInMiOiJ3ZWIiLCJhYWgiOmZhbHNlfQ%3D%3D",
"Formats": [
{
"OutboundFinancialDocumentId": "e90e4213-7354-495c-bb60-cc08aff724f2",
"ContentType": "application/xml",
"DocumentLink": "https://dcn-solution-qa.saphety.com/IN2.ContentStorage.WebApi/api/Content/false?token=tKMUGJ6EcQP2wHJZmh9f1FX3YxV7ImN0SWQiOiJjNzAzN2ZkZC0zMzQ3LTQ2NTktOTI4Zi00NDdmYWE1NGU1ZGMiLCJpRHQiOiIyMDIyLTExLTI5IiwiZUR0IjpudWxsLCJpQnkiOiJTYXBoZXR5IEFQSSBEZW1vIiwiaVRvIjoiU2FwaGV0eSBBUEkgRGVtbyIsInMiOiJ3ZWIiLCJhYWgiOmZhbHNlfQ%3D%3D"
},
{
"OutboundFinancialDocumentId": "e90e4213-7354-495c-bb60-cc08aff724f2",
"ContentType": "application/json",
"DocumentLink": "https://dcn-solution-qa.saphety.com/IN2.ContentStorage.WebApi/api/Content/false?token=OzmfHtRIl47kohIjFZNI1drsrz17ImN0SWQiOiJhNjBjMTdkZS1hN2UwLTQ1MWItOTkzMC03ZDE4ZmQzZGE3ZWIiLCJpRHQiOiIyMDIyLTExLTI5IiwiZUR0IjpudWxsLCJpQnkiOiJTYXBoZXR5IEFQSSBEZW1vIiwiaVRvIjoiU2FwaGV0eSBBUEkgRGVtbyIsInMiOiJ3ZWIiLCJhYWgiOmZhbHNlfQ%3D%3D"
},
{
"OutboundFinancialDocumentId": "e90e4213-7354-495c-bb60-cc08aff724f2",
"ContentType": "application/xml",
"DocumentLink": "https://dcn-solution-qa.saphety.com/IN2.ContentStorage.WebApi/api/Content/false?token=PquoARk8tJFtp4Ss6JCspwj%2Bgh17ImN0SWQiOiJmYWY3ODdkZS0xMzdmLTQ3ODQtODJjMC04MTFmNWZlOTcxZmQiLCJpRHQiOiIyMDIyLTExLTI5IiwiZUR0IjpudWxsLCJpQnkiOiJTYXBoZXR5IEFQSSBEZW1vIiwiaVRvIjoiU2FwaGV0eSBBUEkgRGVtbyIsInMiOiJ3ZWIiLCJhYWgiOmZhbHNlfQ%3D%3D"
},
{
"OutboundFinancialDocumentId": "e90e4213-7354-495c-bb60-cc08aff724f2",
"ContentType": "application/pdf",
"DocumentLink": "https://dcn-solution-qa.saphety.com/IN2.ContentStorage.WebApi/api/Content/false?token=SKHRdpBjAl0OnAc0lXYEtuBSpZZ7ImN0SWQiOiI1NjZiMjljNS03MTQwLTQ5ZGEtOTJhMC1kODBiMDkwOWQ1YTYiLCJpRHQiOiIyMDIyLTExLTI5IiwiZUR0IjpudWxsLCJpQnkiOiJTYXBoZXR5IEFQSSBEZW1vIiwiaVRvIjoiU2FwaGV0eSBBUEkgRGVtbyIsInMiOiJ3ZWIiLCJhYWgiOmZhbHNlfQ%3D%3D"
}
]
}
The invoice permanent link are returned at response “Data.DocumentLink”, see the possible values returned.