Get company custom plan information#

This endpoint is used to get informations from a created custom plan.

Endpoint steps#

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

  2. Get all your subscriptions calling the endpoint Subscriptions/clientId/{companyVatNumber} from WebStore API URL;

  3. Get custom plan information calling the endpoint CustomPlans/{customPlanId} 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 Custom Plan (CustomPlans/{customPlanId})#

2.1 Request structure#

In the endpoint url you need to supply the custom plan id

customPlanId#

  • Description: The custom 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/CustomPlans/" + "1b60cf5d-921b-47b3-94c7-f98008ca5528"
print (service_url)
https://dcn-solution.saphety.com/Dcn.Sandbox.WebApi/api/CustomPlans/1b60cf5d-921b-47b3-94c7-f98008ca5528

2.3 Call the endpoint to get the custom 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",
    "ClientId": "PT503230731",
    "CodeName": "PLANPDF",
    "ServiceType": null,
    "MonthsInCycle": 2,
    "Status": "Available",
    "CreationDate": "2023-01-05T17:44:07.3133333"
}

The CodeName here is custom, created by the product team for each customer’s customized plan