Resend invoice, by standard email notification#

This endpoint is used to resend by email a processed “Electronic invoice” or “PDF invoice”.

The email notification sent to your costumers/receivers has a predefined content layout.

Endpoint steps#

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

  2. Resend notifications calling the endpoint OutboundFinancialDocumentMaintenance/sendAdditionalNotifications;

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. Resend PDF invoice notifications (OutboundFinancialDocumentMaintenance/sendAdditionalNotifications)#

2.1 Request body structure#

{
  {
  "OutboundFinancialDocumentId": "guid",
  "DestinationEmails": [
    {
      "Email": "string",
      "SendAttachment": true,
      "LanguageCode": "string",
      "CC": [
        "string"
      ],
      "BCC": [
        "string"
      ]
    }
  ]
}
}

OutboundFinancialDocumentId#

  • Description: You need to supply the id of the invoice “OutboundFinancialDocumentId”.

  • Required: Yes

  • Type: string

  • Example: “3fa85f64-5717-4562-b3fc-2c963f66afa6”

DestinationEmails#

Array of DestinationEmail

  • Email

    • Description: Defines the primary receiver/customer email address for the notification.

    • Required: Yes

    • Type: string

    • Example: “receiver@example.com

  • SendAttachment

    • Description: Indicates whether the PDF is sent or not as an attachment in the notification.

    • Required: No

    • Type: boolean

    • Example: true

    • Notes: If it’s not declared in the payload, it will assume false.

  • LanguageCode

    • Description: Indicates the email notification language content.

    • Required: No

    • Type: string

    • Allowed values: “pt” or “en”

    • Example: “pt”

    • Notes: If it’s not declared in the payload, it will assume “en”.

  • CC

    • Description: Defines the CC email addresses for the notification.

    • Required: No

    • Type: string array

    • Example: [“cc_recipient1@example.com”, “cc_recipient2@example.com”]

  • BCC

    • Description: Defines the BCC email addresses for the notification.

    • Required: No

    • Type: string array

    • Example: [“bcc_recipient1@example.com”, “bcc_recipient2@example.com”]

2.2 Request example#

# SIN endpoint url
service_url = "https://" + server_base_adress + "/api/OutboundFinancialDocumentMaintenance/sendAdditionalNotifications"
print ("Endpoint url: " + service_url)

#headers
headers = {
    'Content-Type': 'application/json',
    'Authorization': 'bearer ' + token
    }
# payload as json
payload = {
  'OutboundFinancialDocumentId': 'fc5e547d-8537-4e05-97d5-1159c62efd6f',
  'DestinationEmails': [{
    'Email': 'sin_api_documentation_user@saphety.com',
    'SendAttachment': True,
    'LanguageCode': 'PT'
  }]
}
Endpoint url: https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/OutboundFinancialDocumentMaintenance/sendAdditionalNotifications

* Note : in the Sandbox environment, the notifications are sent only for the user registration email, even if within the payload are displayed other email addresses.

2.3 Call endpoint resend notifications#

Resend an invoice by Document id (“OutboundFinancialDocumentId“) using endpoint /api/OutboundFinancialDocumentMaintenance/sendAdditionalNotifications

# Send the request (POST).
response = requests.request("POST", service_url, data=request_data, headers=headers)

# formating the response to json for visualization purposes only
json_response = json.loads(response.text)
print(json.dumps(json_response, indent=4))
{
    "CorrelationId": "50d02294-fe13-49d4-8e5b-77fd02f953f2",
    "IsValid": true,
    "Errors": [],
    "Data": [
        "sin_api_documentation_user@saphety.com"
    ]
}

At response “Data” you will see the email adress where the invoice was sent to.