Skip to main content
Ctrl+K
Logo image
  • Welcome to Saphety Invoice Network API
  • Introduction
    • API Basics
    • API Environments
    • API Support
  • Endpoints
    • Authentication
      • Get token
    • Send invoice
      • Send electronic invoice, using legal format
      • Send PDF invoice, by standard email notification
      • Send PDF invoice, by customized email notification
      • Store PDF invoice
      • Resend invoice, by standard email notification
      • Resend invoice, by costumized email notification
    • Receive invoices
      • Search for electronic invoices
      • Count for electronic invoices
      • Get electronic invoices formats
      • Receive electronic invoices
      • Set electronic invoices status
      • Unblock electronic invoices
    • Invoice lifecycle
      • Get invoice status
      • Get invoice status transitions
    • Invoice archive
      • Get invoice formats
      • Get invoice permanent links
    • Receiver entities
      • Get receivers
    • Interoperability
      • Get networks
      • Get network receivers
      • Get network connection status
    • Plan subscription
      • Get company subscriptions
      • Get company subscription features
      • Get company plan information
      • Get company custom plan information
  • Binder
  • Repository
  • Open issue
  • .ipynb

Get invoice permanent links

Contents

  • Endpoint steps
    • Response structure from server
    • Endpoint Server Base URL
  • 1. Get a token (Account/getToken)
  • 2. Get invoice permalinks (OutboundFinancialDocument/getDocumentPermalinks/{documentId})
    • 2.1 Request structure
      • documentId
    • 2.2 Request example
    • 2.3 Call the endpoint to get the document permalinks

Get invoice permanent links#

This endpoint is used to get a permanent link to acess an invoice stored in archive.

Endpoint steps#

  1. Get a token from your credentials by calling the endpoint Account/getToken;

  2. 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.

previous

Get invoice formats

next

Receiver entities

Contents
  • Endpoint steps
    • Response structure from server
    • Endpoint Server Base URL
  • 1. Get a token (Account/getToken)
  • 2. Get invoice permalinks (OutboundFinancialDocument/getDocumentPermalinks/{documentId})
    • 2.1 Request structure
      • documentId
    • 2.2 Request example
    • 2.3 Call the endpoint to get the document permalinks

By Saphety

© Copyright 2022.