Get network connection status#

This endpoint is used to get the status of a network connection.

Endpoint steps#

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

  2. Get the network connection status by calling the endpoint /IntegrationAccessControl/{clientId}/{businessGroupCode} from IntegrationAccess API URL;

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
integration_access_server_base_adress = "dcn-solution.saphety.com/Dcn.Sandbox.WebApi"

# Saphety Invoice Network - Production Environment
#integration_access_server_base_adress = "dcn-solution.saphety.com/IN2.IntegrationAccess.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 network connection status (IntegrationAccessControl/{clientId}/{groupCode})#

2.1 Request structure#

In the endpoint url you need to supply the clientId and the groupCode

clientId#

  • Description: Tax identification of the entity (aka as vatNumber).

  • Required: Yes

  • Type: string

  • Example: “PT518576302”

  • Notes: Only accepts valid vatNumbers and filled with the countryCode prefix.

groupCode#

  • Description: The group code identification

  • Required: Yes

  • Type: string

  • Example: “iLink”

2.2 Request example#

clientId = 'PT240606590'
groupCode = 'Dcn'
# WebStore endpoint url for retrieving information
service_url = 'https://' + integration_access_server_base_adress + '/api/IntegrationAccessControl/' + clientId + '/' + groupCode
print (service_url)
https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/IntegrationAccessControl/PT240606590/Dcn

2.3 Call the endpoint to get the network connection status#

Get the network connection status using endpoint /api/IntegrationAccessControl/{clientId}/{groupCode}

# build the request
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))
{
    "BusinessGroupCode": "Dcn",
    "ClientId": "PT240606590",
    "ApplicationCode": "DcnSolution",
    "AccessStatus": "Connected",
    "RequestDate": "2023-11-10T00:00:00"
}

The possible values of AccessStatus are:

  • NotConnected

  • AwaitingDocumentAcceptance - Connection is awaiting Document Acceptance

  • AwaitingFeature - Connection is awaiting approval from destination

  • AwaitingApproval - Connection awaiting approval from business group

  • Connected

  • ConditionsChanged - Connection terms and conditions have changed. Connection is still active until last terms and conditions reach end date

  • ConditionsOverdue - Connection is no longer active. New terms and conditions must be accepted

When the connection was never started, an error will be returned.

clientId = 'PT240606590'
groupCode = 'iLink'

# WebStore endpoint url for retrieving information
service_url = 'https://' + integration_access_server_base_adress + '/api/IntegrationAccessControl/' + clientId + '/' + groupCode
print (service_url)
https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/IntegrationAccessControl/PT240606590/iLink
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["Errors"], indent=4))
[
    {
        "Code": "IA0020",
        "Field": "integrationAccessControl",
        "ExplanationValues": [
            {
                "Key": "ClientId",
                "Value": "PT240606590"
            },
            {
                "Key": "BusinessGroupCode",
                "Value": "iLink"
            }
        ]
    }
]