Get company plan information#
This endpoint is used to get informations from a subscribed plan.
Endpoint steps#
Get a token from your credentials by calling the endpoint Account/getToken;
Get all your subscriptions calling the endpoint Subscriptions/clientId/{companyVatNumber} from WebStore API URL;
Get plan information calling the endpoint Plans/{planId} from WebStore 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
webstore_server_base_adress = "dcn-solution.saphety.com/Dcn.Sandbox.WebApi"
# Saphety Invoice Network - Production Environment
#webstore_server_base_adress = "dcn-solution.saphety.com/IN2.WebStore.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 Plan (Plans/{planId})#
2.1 Request structure#
In the endpoint url you need to supply the plan id
planId#
Description: The plan unique identification (GUID)
Required: Yes
Type: string
Example: “1b60cf5d-921b-47b3-94c7-f98008ca5528”
2.2 Request example#
# WebStore endpoint url for retrieving information
service_url = "https://" + webstore_server_base_adress + "/api/Plans/" + "1b60cf5d-921b-47b3-94c7-f98008ca5528"
print (service_url)
https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/Plans/1b60cf5d-921b-47b3-94c7-f98008ca5528
2.3 Call the endpoint to get the plan information#
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))
{
"Id": "1b60cf5d-921b-47b3-94c7-f98008ca5528",
"CodeName": "PlanPdf2",
"ServiceType": "EmailPdf",
"GrossValue": 0.49,
"MonthsInCycle": 12,
"TrialPeriodDays": 0,
"Status": "Available",
"CreationDate": "2023-01-05T17:44:07.3133333"
}
The CodeName’s available for eletronic invoices are:
Plan0: Light plan (monthly).
Plan1: Basic plan (monthly).
Plan4: Plus plan (monthly).
Plan2: Advanced plan (monthly).
Plan3: Pro plan (monthly).
SP50: Plan with 50 eletronic invoices (annually).
SP600: Plan with 600 eletronic invoices (annually).
SP2000: Plan with 2000 eletronic invoices (annually).
The CodeName’s available for pdf invoices are:
PlanPdf1: Basic plan (annually).
PlanPdf2: Plus plan (annually).
PlanPdf3: Advanced plan (annually).
PlanPdf4: Pro plan (annually).