Management SDK
License management is a module that provides APIs for generating license keys, placing, searching and updating orders as well as licenses. See Management API for more information on the API.
License Management APIs should not be implemented in application distributions. Keep your management keys safe.
If you wish to use license management in your Maven/Gradle project, use this snippet:
Javadoc, jar and OSGi bundle downloads can be found at: Javadoc & Downloads
There is only one parameter needed to initialize the ManagementConfiguration:
- managementKey, your company management API key
Management key is available to you in the LicenseSpring web platform under "Settings -> Keys" section.
Optional parameter:
- requestLogging default is Logger.Level.NONE
- requestTimeout set the timeout of requests make to API (in seconds), default is 10 seconds
Licenses can be managed through LicenseService object. You can make the LicenseService object by passing the configuration you made before.
This method returns the paginated result that contains a list of licenses that satisfy your request. SearchLicensesRequest can be made with the builder.
Possible order options:
- id
- status
- customer__email
- customer__company_name
- customer__reference
- created_at
- updated_at
- active
- enabled
- time_activated
- time_disabled
- max_activations
- times_activated
- valid_duration
- validity_period
- license_type
- enable_maintenance_period
- maintenance_duration
- maintenance_period
- is_trial
- max_consumptions
- total_consumptions
- subscription_id
- last_check
- prevent_vm
- allow_overages
- max_overages
- reset_consumption
- consumption_period
- trial_days
- is_floating
- is_floating_cloud
- floating_users
- note
- max_license_users
- order
- order_item
- license_key
- disabled_user
If you set the sortDescending field to true, the order of the results will be descending, default order is ascending.
This method goes through all pages of the search result and puts all licenses in a list that is then returned. Should be used if there is a need for all licenses that satisfy the request so the user doesn't have to execute the search n times increasing the offset in the initial result.
Disables all the licenses whose ids are listed in the argument. This sets all the devices linked to the license to not active, sets the user who disabled the license, turns license status to inactive and sets the time_disabled field to now. Returns true if disabling was successful, false if disabling failed.
Retrieves detailed information from the server about the license with the provided id.
Updates the requested fields in the license with the provided id. Returns the updated license. UpdateLicenseRequest can be made with the builder.
Patches the license (product) features available.
Thread carefully when using this method, posting an empty request will remove all features.
Assigns the provided user to the license with the provided id. AssignedLicenseUser can be made with the builder. Only required field is email. Returns a message that can either be :
- "License was successfully assigned and users new password is password". This will be returned when user assigned to the license is a first time user and password wasn't set as a field in AssignUserToLicenseRequest object, password will be generated from the server and passed in the string. The initial password can also be seen on the LicenseSpring platform. The other use case when this will be returned is when the user assigned to the license already owns at least one license and therefore already has a password, but if the field password in the AssignUserToLicenseRequest object was set, than users old password will be rewritten to the new password and sent as a confirmation in the message.
- "License was successfully assigned and user already has a password." This will be returned when the user assigned to the license already has at least one license and therefore already has a password and the password field in the AssignUserToLicenseRequest object wasn't set.
Assigns multiple users to a single license if requesting manager has access permissions to it.
Unassigns a user from a single license if requesting manager has access permissions to it.
Sets the license users password to a new value.
Disables the license with the provided id. Will throw exception if license with that id doesn't exist. Sets the status of the license to disabled, time_disabled to now, all devices set to inactive and sets the user who disabled the license. Returns true if disabling was successful, false if otherwise.
Resets the license with the provided id. Sets the status to inactive, times_activated to 0, and all devices linked to the license to inactive.
Enables the license with the provided id. Returns detailed license information that is now enabled.
Resets the total consumptions on the license to zero.
To manage custom fields on licenses, call LicenseCustomFieldsService methods. Service is available through LicenseService class.
Searches through all license custom fields and returns the search result which contains all license custom fields that satisfy the request queries.
Goes through all pages of the search license custom fields response and returns a list with all possible license custom fields that satisfy the request. Makes multiple requests to the server until all results have been found.
Retrieves license custom field data.
Creates a new license custom field.
Updates the license custom field.
Deletes the license custom field.
Devices can be managed through LicenseService object. You can make the LicenseService object by passing the configuration you made before.
This method returns the paginated result that contains a list of devices that satisfy your request. SearchDevicesRequest can be made using builder.
Possible filters:
- license
- blacklisted
- hostname
- hardware_id
The result list can be sorted in descending order if the flag sortDescending is set to true. This, of course, only works if orderBy is set. Default order is ascending.
This method goes through all pages of the search result and puts all devices in a list that is then returned. Should be used if there is a need for all devices that satisfy the request so the user doesn't have to execute the search n times increasing the offset in the initial result.
Gets the device with the provided id.
Resets the device.
Blacklists the device.
To manage device variables, call DeviceVariablesService methods. Service is available through LicenseService class.
Searches through all device variables and returns the search result which contains all device variables that satisfy the request queries.
Goes through all pages of the search device variables response and returns a list with all possible device variables that satisfy the request. Makes multiple requests to the server until all results have been found.
Retrieves device variable data.
Creates a new device variable.
Updates the device variable
Deletes the device variable.
All requests for Orders API should be done via the OrderService object. You can make the OrderService object by passing the configuration you made before.
This method returns the paginated result that contains a list of orders that satisfy your request. SearchOrdersRequest can be made with builder.
Possible filters:
- store_id
- store_id__startswith
- store_id__icontains
- customer__email
- customer__email__startswith
- customer__email__icontains
- company
- customer_id
- customer_email
- customer_company_name
- customer_company_name__icontains
- customer_reference__icontains
- customer_name__icontains
Default order is ascending, to get descending order set the flag sortDescending to true.
Returns the order with the provided id.
This method goes through all pages of the search result and puts all orders in a list that is then returned. Should be used if there is a need for all orders that satisfy the request so the user doesn't have to execute the search n times increasing the offset in the initial result.
Creates an Order and returns the generated orderId and a list of emails and their respective passwords if the user is new and was listed in the WebHookOrder.
Returns a String array filled with generated license keys that can be used to place orders. GenerateLicenseRequest can be made with builder.
Adds a manager to an order.
Makes a request to the server to send the csv file with all orders made in the requested range. Destination is a path where the file should be saved. If the argument is set to null, the SDK will try to save it to the desktop or home if desktop is unavailable. This method returns the filepath where the file was saved. From and to are LocalDate types, can be made like this: LocalDate from = LocalDate.of(GGGG,MM,DD)
Example of how the csv will be named: 2020-07-01to2020-09-01.csv
Makes a request to the server to send the csv file with all orders made in the requested range. Range is an enum with values:last30, last60, last180, last365, where numbers specify days (last30 is all orders from the last 30 days). Destination is a path where the file should be saved. If the argument is set to null, the SDK will try to save it to the desktop or home if desktop is unavailable. This method returns the filepath where the file was saved. From and to are LocalDate types, can be made like this: LocalDate from = LocalDate.of(GGGG,MM,DD)
Example of how the csv will be named: 2020-07-01to2020-09-01.csv
Products can be managed through OrderService object. You can make the OrderService object by passing the configuration you made before.
This method returns the paginated result that contains a list of products that satisfy your request. SearchProductsRequest can be made with builder.
Gets details about the product with specified id.
This method goes through all pages of the search result and puts all products in a list that is then returned. Should be used if there is a need for all products that satisfy the request so the user doesn't have to execute the search n times increasing the offset in the initial result.
Use OrderService object to manage installation files.
Searches the InstallationFiles by applying the filtering and ordering conditions in the SearchInstallationFilesRequest class.
Goes through all pages of the response and returns a list with all possible installation files that satisfy the request. Makes multiple requests to the server until all results have been found.
Gets the installation file with the provided id.
Creates and returns a new InstallationFile with the details provided in the request.
Use OrderService.productCustomFieldsService() method to get a service for managing products custom fields.
Searches through all product custom fields and returns the search result which contains all product custom fields that satisfy the request queries.
Retrieves product custom field data.
Creates a new product custom field.
Updates the product custom field.
Deletes the product custom field.
Goes through all pages of the search product custom fields response and returns a list with all possible product custom fields that satisfy the request. Makes multiple requests to the server until all results have been found.