Order Attributes. Attributes Validation
The Order Attributes URL allows a service to request additional data when a subscription is ordered in ActivePlatform. The Attributes Validation URL is used to validate the specified values.
The general flow for the Order Attributes and Attributes Validation events includes the following steps:
- A user orders a vendor's service via ActivePlatform.
As part of the provisioning process, ActivePlatform calls the Order Attributes URL of a microservice and sends information about the reseller and distributor attributes of the product.
POST /order/attributes
Body:
Name
Data type
Description
reseller object Information about the reseller who sold the subscription to a service plan of a product via ActivePlatform (see Viewing and updating reseller general information in the Operator Comtrol Panel guide) id integer The reseller ID name string The reseller name company_name string The company name first_address string Address line 1 second_address string Address line 2 city string City region string Region zip string Zip code country string Country code company_phone string The company's phone number in the international format company_email string The company's email address currency string The reseller currency code attributes object The list of the product attributes (key-value pairs) applied to the reseller (see Extending the reseller object and Product attributes): - {reseller_attribute_key} — the reseller attribute key.
- {reseller_attribute_value} — the reseller attribute value (see Viewing and editing the reseller attributes in the Operator Comtrol Panel guide).
core_attributes object The list of public custom attributes (key-value pairs) applied to the reseller in ActivePlatform (see in the Viewing the list of attributes Operator Comtrol Panel guide): - {reseller_attribute_key} — the custom attribute key.
- {reseller_attribute_value} — the custom attribute value.
distributor object Information about the distributor (a reseller in ActivePlatform, see Viewing and updating reseller general information in the Operator Comtrol Panel guide) who received the published product (see Add distributors) id integer The distributor ID name string The distributor name region string The distributor location: region currency string The distributor currency code attributes object The list of the product attributes applied to a distributor (see Extending the distributor object and Product attributes): - {distributor_attribute_key} — the distributor attribute key.
- {distributor_attribute_value} — the distributor attribute value (see Viewing and editing the distributor attributes in the Operator Comtrol Panel guide).
attributes_for string Defines the target Panel to display additional order attributes:- client — the Customer Control Panel (
/plugin/vendor_service/client/attributes/new
). - reseller — the Operator Control Panel (
/plugin/vendor_service/attributes/new
) or API (Get the list of the reseller's plan order attributes).
Usually, all attributes are displayed for a manager and customer without any difference. However, in some cases, an attribute should be displayed for a manager only. For instance, a reseller's code for a discount (see Approval Code in Kaspersky (PAYG, Yearly). Service specifics in Services. Operator Guide), which does not have any sense for a customer, will not be included in the microservice response and thus not displayed in the Customer Control Panel if
attributes_for = client
.- The microservice returns to ActivePlatform a JSON with the information required for the subscription provisioning.
Response status: 200
Response body:
Name
Data type
Description
attributes array of objects Information about the order attributes required for the subscription provisioning label string Attribute name (see Label name in Product attributes) type string Attribute data type (see Type in Product attributes) key string Attribute key (see Key in Product attributes) description string Attribute description priority string Attribute priority (see Weight in Product attributes) default_value string Attribute default value hint string Text of a hint for an attribute to display to the user on a page with the order attributes values array
List of valid values of an attribute, if applied - ActivePlatform displays to the user a page for specifying the values of the order attributes from the JSON.
The user specifies the values of the order attributes.
ActivePlatform sends a JSON to the microservice to the Attributes Validation URL to validate the specified values.
POST /attributes/validation
Body:
Name
Data type
Description
reseller object Information about the reseller who sold the subscription to a service plan of a product via ActivePlatform (see Viewing and updating reseller general information in the Operator Comtrol Panel guide) id integer The reseller ID name string The reseller name company_name string The company name first_address string Address line 1 second_address string Address line 2 city string City region string Region zip string Zip code country string Country code company_phone string The company's phone number in the international format company_email string The company's email address currency string The reseller currency code attributes object The list of the product attributes (key-value pairs) applied to the reseller (see Extending the reseller object and Product attributes): - {reseller_attribute_key} — the reseller attribute key.
- {reseller_attribute_value} — the reseller attribute value (see Viewing and editing the reseller attributes in the Operator Comtrol Panel guide).
core_attributes object The list of public custom attributes (key-value pairs) applied to the reseller in ActivePlatform (see in the Viewing the list of attributes Operator Comtrol Panel guide): - {reseller_attribute_key} — the custom attribute key.
- {reseller_attribute_value} — the custom attribute value.
distributor object Information about the distributor (a reseller in ActivePlatform, see Viewing and updating reseller general information in the Operator Comtrol Panel guide) who received the published product (see Add distributors) id integer The distributor ID name string The distributor name region string The distributor location: region currency string The distributor currency code attributes object The list of the product attributes applied to a distributor (see Extending the distributor object and Product attributes): - {distributor_attribute_key} — the distributor attribute key.
- {distributor_attribute_value} — the distributor attribute value (see Viewing and editing the distributor attributes in the Operator Comtrol Panel guide).
{order attributes} string The list order attributes (key-value pairs) for validation: - {order_attribute_key} — the order attribute key.
- {order_attribute_value} — the order attribute value specified by a user.
attributes_for string Defines the origin Panel for the specified additional order attributes: - client — the Customer Control Panel (
/plugin/vendor_service/client/attributes/new
). - reseller — the Operator Control Panel (
/plugin/vendor_service/attributes/new
) or API (see Validate the reseller's Plan order attributes).
- The vendor's service validates the data:
- If the data is not valid, the microservice sends back a JSON with the error message.
Response status: 200
Response body:
Name
Data type
Description
{order_attribute_key} string The order attribute key of the attribute with a value caused an error {error description} array The text of the order attribute error to display to the user on a page with the order attributes - If the data is valid:
- The microservice attaches the provided data to the JSON to send it to the service provider and create a subscription (see Subscription Create).
- The microservice responds to ActivePlatform with an empty JSON and status: 200.
- If the data is not valid, the microservice sends back a JSON with the error message.
Event and response examples
An example describes ordering a subscription to the Google Workspace (G Suite) service (see Ordering a "Google Workspace" Subscription in Services. User documentation):
Example request of order attributes for the specified reseller:
POST http://g-suite.activeplatform.com/v1/order/attributes
{ "reseller": { "id": 2, "name": "Root", "company_name": "Dev acc", "first_address": "Street building", "second_address": "", "city": "City", "region": "Region", "zip": "220000", "country": "US", "company_phone": "+123555456", "company_email": "email@example.com", "currency": "USD", "attributes": { "reseller_admin_email": "admin@example.com", "service_account_email": "AP0500", "certificate": "===" }, "core_attributes": { "kaspersky_reseller_pin": "********" } }, "distributor": { "id": 1, "name": "Example LLC", "region": "Quinsk", "currency": "USD", "attributes": { "reseller_public_id": "1234a5678" } }, "attributes_for": "reseller" }
Example respond with information about order attributes:
HTTP code status: 200 OK{ "attributes":[ { "label":"Domain name", "type":"string", "key":"domain_name", "description":"", "priority":"1", "default_value":"", "hint":"Enter the domain name of your legal entity. Your G Suite Account will be registered to the domain name you specified, for instance, example.com. You will need to confirm the ownership of the domain after the registration.", "values":[] }, { "label":"Alternate customer email", "type":"string", "key":"customer_alternate_email", "description":"", "priority":"2", "default_value":"", "hint":"Specify alternate email as secondary contact used if something happens such as service outage or a security issue. Email should not contain the same domain as Domain name field.", "values":[] }, { "label":"Administrator's account username", "type":"string", "key":"admin_login", "description":"", "priority":"3", "default_value":"", "hint":"Enter the name of the Account owner. The name will be used as a login. The Account owner can add other Subscription users.", "values":[] }, { "label":"Domain name", "type":"string", "key":"transfer_domain_name", "description":"", "priority":"4", "default_value":"", "hint":"Enter your main domain on Google, for instance, example.com.", "values":[] }, { "label":"Transfer token", "type":"string", "key":"transfer_token", "description":"", "priority":"5", "default_value":"", "hint":"A Transfer Token is a 16-digit alphanumeric code that can be generated from the Google admin console by the link.", "values":[] } ] }
Example request to validate the values of the order attributes specified by a user:
POST http://g-suite.activeplatform.com/v1/attributes/validation
{ "reseller": { "id": 2, "name": "Root", "company_name": "Dev acc", "first_address": "Street building", "second_address": "", "city": "City", "region": "Region", "zip": "220000", "country": "US", "company_phone": "+123555456", "company_email": "email@example.com", "currency": "USD", "attributes": { "reseller_admin_email": "admin@example.com", "service_account_email": "AP0500", "certificate": "===" }, "core_attributes": { "kaspersky_reseller_pin": "********" } }, "distributor": { "id": 1, "name": "Example LLC", "region": "Quinsk", "currency": "USD", "attributes": { "reseller_public_id": "1234a5678" } }, "domain_name": "example.com", "customer_alternate_email": "email@example.net", "admin_login": "Owner", "attributes_for": "reseller" }
- Example respond with the validation results:
- If the data is not valid:
HTTP code status: 200 OK
{ "admin_login":[ "Wrong admin login. Only Latin alphanumeric symbols are allowed" ] }
- If the data is valid:
HTTP code status: 200 OK
{ }
- If the data is not valid:
If a sent JSON is not valid, a microservice returns an error message:
HTTP code status: 400 Bad request
{
"title":"Invalid JSON",
"description":"Could not parse JSON body — Expecting value: line 1 column 1 (char 0)"
}