SDKs
...
Java SDK
Java Modules

Management SDK

70min

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:

XML
Java


Javadoc, jar and OSGi bundle downloads can be found at: Javadoc & Downloads

Initializing the Management Client

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
  • proxyPort and proxyHost used to setup a forward proxy, see more in Java Advanced Usage
  • requestTimeout set the timeout of requests make to API (in seconds), default is 10 seconds
Java


License Management

Licenses can be managed through LicenseService object. You can make the LicenseService object by passing the configuration you made before.

Java


searchLicenses(SearchLicensesRequest request)

This method returns the paginated result that contains a list of licenses that satisfy your request. SearchLicensesRequest can be made with the builder.

Java


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.

paginateThroughAllLicenses(SearchLicensesRequest request)

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.

Java


disableAllLicenses(Long[] licenseIds)

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.

Java


getLicense(Long licenseId)

Retrieves detailed information from the server about the license with the provided id.

Java


updateLicense(Long licenseId, UpdateLicenseRequest request)

Updates the requested fields in the license with the provided id. Returns the updated license. UpdateLicenseRequest can be made with the builder.

Java


patchLicenseFeatures(Long licenseId, PatchLicenseFeaturesRequest request)

Patches the license (product) features available.

Thread carefully when using this method, posting an empty request will remove all features.

Java


assignUser(Long licenseId, AssignUserToLicenseRequest licenseUser)

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.
Java


assignMultipleUsers(Long licenseId, AssignMultipleUsersRequest request)

Assigns multiple users to a single license if requesting manager has access permissions to it.

Java


unassignUser(Long licenseId, int licenseUserId)

Unassigns a user from a single license if requesting manager has access permissions to it.

Java


setUserPassword(int userId, String newPassword)

Sets the license users password to a new value.

Java


disableLicense(Long id)

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.

Java


resetLicense(Long id)

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.

Java


enableLicense(Long id)

Enables the license with the provided id. Returns detailed license information that is now enabled.

Java


resetTotalConsumptions(Long licenseId)

Resets the total consumptions on the license to zero.

Java


License Custom Fields Management

To manage custom fields on licenses, call LicenseCustomFieldsService methods. Service is available through LicenseService class.

Java


search(SearchLicenseCustomFieldsRequest request)

Searches through all license custom fields and returns the search result which contains all license custom fields that satisfy the request queries.

Java


paginate(SearchLicenseCustomFieldsRequest request)

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.

Java


get(Integer id)

Retrieves license custom field data.

Java


create(CreateLicenseCustomFieldRequest request)

Creates a new license custom field.

Java


update(Integer id, UpdateCustomLicenseFieldRequest request)

Updates the license custom field.

Java


delete(Integer id)

Deletes the license custom field.

Java


Device Management

Devices can be managed through LicenseService object. You can make the LicenseService object by passing the configuration you made before.

Java


searchDevices(SearchDevicesRequest request)

This method returns the paginated result that contains a list of devices that satisfy your request. SearchDevicesRequest can be made using builder.

Java


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.

paginateThroughAllDevices(SearchDevicesRequest request)

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.

Java


getDevice(Long id)

Gets the device with the provided id.

Java


resetDevice(Long id)

Resets the device.

Java


blacklistDevice(Long id)

Blacklists the device.

Java


Device Variables Management

To manage device variables, call DeviceVariablesService methods. Service is available through LicenseService class.

Java


search(SearchDeviceVariablesRequest request)

Searches through all device variables and returns the search result which contains all device variables that satisfy the request queries.

Java


paginate(SearchDeviceVariablesRequest request)

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.

Java


get(Integer id)

Retrieves device variable data.

Java


create(CreateDeviceVariableRequest request)

Creates a new device variable.

Java


update(Integer id, UpdateDeviceVariableRequest request)

Updates the device variable

Java


delete(Integer id)

Deletes the device variable.

Java


Order Management

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.

Java


searchOrders(SearchOrdersRequest request)

This method returns the paginated result that contains a list of orders that satisfy your request. SearchOrdersRequest can be made with builder.

Java


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.

getOrder(Long id)

Returns the order with the provided id.

Java


paginateThroughAllOrders(SearchOrdersRequest request)

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.

Java


createOrder(WebhookOrder order)

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.

Java


generateLicenseKeys(GenerateLicenseRequest request)

Returns a String array filled with generated license keys that can be used to place orders. GenerateLicenseRequest can be made with builder.

Java


addManagerToOrder(Long orderId, AddManagerToOrderRequest request)

Adds a manager to an order.

Java


exportToCsv(LocalDate from, LocalDate to, String destination)

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

Java


exportToCsv(Range range, String destination)

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:last30last60last180last365, 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

Java


Product Management

Products can be managed through OrderService object. You can make the OrderService object by passing the configuration you made before.

Java


searchProducts(SearchProductsRequest request)

This method returns the paginated result that contains a list of products that satisfy your request. SearchProductsRequest can be made with builder.

Java


getProduct(Long id)

Gets details about the product with specified id.

Java


paginateThroughAllProducts(SearchProductsRequest request)

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.

Java


Installation File Management

Use OrderService object to manage installation files.

Java


searchInstallationFiles(SearchInstallationFilesRequest request)

Searches the InstallationFiles by applying the filtering and ordering conditions in the SearchInstallationFilesRequest class.

Java


paginateThroughAllInstallationFiles(SearchInstallationFilesRequest request)

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.

Java


getInstallationFile(int id)

Gets the installation file with the provided id.

Java


createInstallationFile(CreateInstallationFileRequest request)

Creates and returns a new InstallationFile with the details provided in the request.

Java


Product Custom Field Management

Use OrderService.productCustomFieldsService() method to get a service for managing products custom fields.

Java


search(SearchProductCustomFieldsRequest request)

Searches through all product custom fields and returns the search result which contains all product custom fields that satisfy the request queries.

Java


get(Integer id)

Retrieves product custom field data.

Java


create(CreateProductCustomFieldRequest request)

Creates a new product custom field.

Java


update(Integer id, UpdateProductCustomFieldRequest request)

Updates the product custom field.

Java


delete(Integer id)

Deletes the product custom field.

Java


paginate(SearchProductCustomFieldsRequest request)

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.

Java