For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

If you wish to use license management in your Maven/Gradle project, use this snippet:

     <dependencies>
       <dependency>
            <groupId>com.licensespring</groupId>
            <artifactId>licensespring-license-management</artifactId>
            <version>2.16.1</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>jdk-java</id>
            <url>https://licensespring-maven.s3.eu-central-1.amazonaws.com/</url>
        </repository>
    </repositories>
repositories {
    mavenLocal()
    maven {
        url = 'https://licensespring-maven.s3.eu-central-1.amazonaws.com/'
    }
}

dependencies {
    implementation 'com.licensespring:licensespring-license-management:2.16.1'
}

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

License Management

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

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.

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.

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.

getLicense(Long licenseId)

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

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.

patchLicenseFeatures(Long licenseId, PatchLicenseFeaturesRequest request)

Patches the license (product) features available.

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.

assignMultipleUsers(Long licenseId, AssignMultipleUsersRequest request)

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

unassignUser(Long licenseId, int licenseUserId)

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

setUserPassword(int userId, String newPassword)

Sets the license users password to a new value.

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.

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.

enableLicense(Long id)

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

resetTotalConsumptions(Long licenseId)

Resets the total consumptions on the license to zero.

License Custom Fields Management

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

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.

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.

get(Integer id)

Retrieves license custom field data.

create(CreateLicenseCustomFieldRequest request)

Creates a new license custom field.

update(Integer id, UpdateCustomLicenseFieldRequest request)

Updates the license custom field.

delete(Integer id)

Deletes the license custom field.

Device Management

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

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.

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.

getDevice(Long id)

Gets the device with the provided id.

resetDevice(Long id)

Resets the device.

blacklistDevice(Long id)

Blacklists the device.

Device Variables Management

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

search(SearchDeviceVariablesRequest request)

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

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.

get(Integer id)

Retrieves device variable data.

create(CreateDeviceVariableRequest request)

Creates a new device variable.

update(Integer id, UpdateDeviceVariableRequest request)

Updates the device variable

delete(Integer id)

Deletes the device variable.

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.

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.

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.

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.

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.

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.

addManagerToOrder(Long orderId, AddManagerToOrderRequest request)

Adds a manager to an order.

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

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

Product Management

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

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.

getProduct(Long id)

Gets details about the product with specified id.

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.

Installation File Management

Use OrderService object to manage installation files.

searchInstallationFiles(SearchInstallationFilesRequest request)

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

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.

getInstallationFile(int id)

Gets the installation file with the provided id.

createInstallationFile(CreateInstallationFileRequest request)

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

Product Custom Field Management

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

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.

get(Integer id)

Retrieves product custom field data.

create(CreateProductCustomFieldRequest request)

Creates a new product custom field.

update(Integer id, UpdateProductCustomFieldRequest request)

Updates the product custom field.

delete(Integer id)

Deletes the product custom field.

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.

Last updated

Was this helpful?