Check invoice email tracking ids#

Use this service to check an invoice email tracking ids for your processed document.

Service steps#

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

  2. Get all invoice email tracking ids calling the service OutboundFinancialDocument/emailTrackingIds/{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 service called */

1. Get a token (Account/getToken)#

Credentials have be given to you, according to your registration at SANDBOX or Saphety Invoice Network:

  • For Test purposes, the user and password defined at SANDBOX registration

  • For Production, the user and password defined at Saphety Invoice Network registration

Use those credentials to get a token at:

# SANDBOX - Test Environment
server_base_adress = ""

# Saphety Invoice Network - Production Environment
#server_base_adress = ""
import requests
import json

# SIN account service url
service_url = "https://" + server_base_adress + "/api/Account/getToken"

# the username and password you registerd in SIN
username = '[email protected]'
password = 'request_password'

# auhtentication data goes in payload as json
payload = {
      'Username': username,
      'Password': password
# payload goes in json, serialize the payloal object to json
# indicate in header that payload is json
headers = {
    'content-type': 'application/json'
# POST request to get a token
response = requests.request("POST", service_url, data=request_data, headers=headers)

* Note: the credentials (user and password) in this documentation were created by Saphety and can only be used in the SANDBOX environment. For tests we recommend that you use the credentials you obtained when registering with the SANDBOX.

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response, indent=4))
    "CorrelationId": "5b7763bf-cb80-4344-b795-af03fde75914",
    "IsValid": true,
    "Errors": [],
    "Data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiJzaW1hby5nb2RpbmhvQHNhcGhldHkuY29tIiwidW5pcXVlX25hbWUiOiJTaW3Do28gR29kaW5obyIsInN5c3RlbV9hZG1pbiI6IkZhbHNlIiwic2Vzc2lvbl9pZCI6IjA5NDMyMTQyLTQ2NGEtNGU5MS04MzZjLWVkZTYyY2YyOWJkNSIsImNwIjoic2ltYW8uZ29kaW5ob0BzYXBoZXR5LmNvbSIsInJsIjoiRGV2ZWxvcGVyIiwibmJmIjoxNjM2NjQ0NjIwLCJleHAiOjE2NDI2NDQ1NjAsImlhdCI6MTYzNjY0NDU2MCwiaXNzIjoiaHR0cHM6Ly93d3cuc2FwaGV0eS5jb20vIiwiYXVkIjoiaHR0cHM6Ly93d3cuc2FwaGV0eS5jb20vRGNuU2FuZGJveCJ9.YY5VyhU8WSYcgEqSteHFN8oDlNfG5ZWBS5fH5uuPzvk"
# your token is at:
token = json_response["Data"];
print (token)

2. Get a Document email tracking ids by DocumentId (OutboundFinancialDocument/emailTrackingIds/{documentId})#

Build the service endpoint url#

In the service url you need to supply the outboundfinancialdocumentId received

# SIN service url for retrieving inforfation on invoice previously sent
service_url = """{ServerBaseUrl}/api/OutboundFinancialDocument/emailTrackingIds/{OutboundFinancialDocumentId}""".format(
service_url = "https://" + service_url
print (service_url)

Call the service to get the document’s email tracking ids#

You will call the service endpoint url

# build the request
headers = {
    'Authorization': 'bearer ' + token
# POST request to send the invoice
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))
        "EmailTrackingId": "6bbf706c-78d4-46e3-9ed1-275715c7309b",
        "OutboundFinancialDocumentId": "fc5e547d-8537-4e05-97d5-1159c62efd6f"