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 docid\ abk8afs7gbmtujl rd 4p 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 \<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 docid\ dm ksn9s vvhglpywsm5x 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 docid\ mqlrngvkrepj5ivdgupt0 requesttimeout set the timeout of requests make to api (in seconds), default is 10 seconds managementconfiguration configuration = managementconfiguration builder() managementkey("management key") build(); // if you want to see logs of the requests sent to management api // turn the logging in the configuration property managementconfiguration configuration = managementconfiguration builder() managementkey("management key") requestlogging(logger level full) build(); license management licenses can be managed through licenseservice object you can make the licenseservice object by passing the configuration you made before licenseservice licenseservice = new licenseservice(configuration); 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 // example of a request with no filters requirements, by default it returns 20 licenses searchlicensesrequest request = searchlicensesrequest builder() build(); searchresult\<backofficelicense> response = licenseservice searchlicenses(request); // example of a more complex request searchlicensesrequest request = searchlicensesrequest builder() licensekeycontains("gggg") licenseusertrueemailcontains("@company com") limit(1) customercompanynamecontains("company") build(); // example with a request with all possible queries except orderby (example below) // note that you can set as many fields as you want to searchlicensesrequest request = searchlicensesrequest builder() licensekey("gggg hhhh ffff") // if you have multiple companies under your control, // you can specify which companies licenses you want to search // by putting in the company code company(1) 	 // if you want to gather specific licenses by their ids 	 // you can put a coma separated list of license ids 	 idin("1593781774572379,1597395059215709,1597395059216729") customercompanynamecontains("enterprise") customeremail("@company com") customerid(12) customernamecontains("john") customerreferencecontains("reference") licensekeycontains("hhhhh") licensekeystartswith("gggg") 	 // if set to true, the result will contain only user based licenses 	 // if set to false, the result will contain only key based licenses 	 licensekeyisnull(true) licenseuseremail("john\@company com") licenseuseremailcontains("company") licenseuseremailstartswith("john") orderstoreid("123456789101112") orderstoreidcontains("456") orderstoreidstartswith("123") 	 // case insensitive 	 notecontains("part of the note") 	 // if true, the result will contain only floating licenses 	 // if false, the result will contain only non floating licenses 	 isanyfloating(true) // how many licenses you want to get at most // default is 20 limit(3) // offset from the beggining of the list of results // default is 0 offset(1) build(); // example of ordering results // ascending order by the attribute created at try { 	searchlicensesrequest request = searchlicensesrequest builder() limit(15) orderby("created at") build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } // descending order by the attribute created at try { 	searchlicensesrequest request = searchlicensesrequest builder() limit(15) orderby("created at") sortdescending(true) build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } // example of a wrong sort attribute, builder will throw exception try { searchlicensesrequest request = searchlicensesrequest builder() orderby("wrong filter") build(); } catch(licensespringsortingexception ex) { log error("wrong filter used in searching licenses, see documentation on kwiki "); } 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 searchlicensesrequest request = searchlicensesrequest builder() licensekeycontains("gggg") customercompanynamecontains("company") build(); list\<backofficelicense> licenses = licenseservice paginatethroughalllicenses(request); 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 long\[] licenseids = {1234567890101112l, 12345678901011121l}; if (licenseservice disablealllicenses(licenseids)) { log info("disabling of licenses with " + ids + " ids was successful "); } else { // try again, check if ids are correct } getlicense(long licenseid) retrieves detailed information from the server about the license with the provided id long licenseid = 1234567891234567l; try { backofficelicense license = licenseservice getlicense(licenseid); } catch (licensespringexception ex) { // license with that id probably doesn't exist } 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 long licenseid = 1234567891234567l; updatelicenserequest request = updatelicenserequest builder() allowoverages(true) build(); backofficelicense updated = licenseservice updatelicense(licenseid, request); // request with all possible fields updatelicenserequest request = updatelicenserequest builder() allowoverages(true) maxoverages(5) maxconsumptions(100) resetconsumption(true) consumptionperiod("daily") floatingusers(2) isfloating(false) // license can be either floating or floating cloud isfloatingcloud(true) istrial(true) trialdays(10) enabled(true) enablemaintenanceperiod(true) maintenanceduration("1year") maxactivations(20) preventvm(true) validduration("1year") validityperiod("2020 09 30") build(); backofficelicense updated = licensesservice updatelicense(id,request); 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 // this will erase all features on the license long id = 1234567891011121l; patchlicensefeaturesrequest build = patchlicensefeaturesrequest builder() build(); backofficelicense backofficelicense = service patchlicensefeatures(id, build); // putting all features from the product on the license list\<licensefeaturepatch> features = product getproductfeatures() stream() map(feature > licensefeaturepatch builder() productfeature(feature getcode()) maxconsumption(feature getmaxconsumption())) map(licensefeaturepatch licensefeaturepatchbuilder build) collect(collectors tolist()); backofficelicense backofficelicensewithfeatures = service patchlicensefeatures(id, patchlicensefeaturesrequest builder() productfeatures(features) build()); 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 long licenseid = 1234567891234567l; // example 1 first time user with only required parameters assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") build(); // response will be "license was successfully assigned and users new password is initial password that server set " // password will be random 8 characters including a z, a z, 0 9, and special characters string response = licenseservice assignuser(licenseid, request); // example 2 first time user with all parameters and set password assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") firstname("john") lastname("doe") phonenumber("000 111 000") ismanager(false) password("password") build(); // response will be "license was successfully assigned and users new password is password " string response = licenseservice assignuser(licenseid, request); // example 3 assigning a user that already exists in the database but changing his password assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") password("password") build(); // response will be license was successfully assigned and users new password is password " string response = licenseservice assignuser(licenseid, request); // example 4 assigning a user that already exists in the databse and not setting the password field assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") build(); // response will be "license was successfully assigned and user already has a password " string response = licenseservice assignuser(licenseid, request);// this will erase all features on the license long id = 1234567891011121l; patchlicensefeaturesrequest build = patchlicensefeaturesrequest builder() build(); backofficelicense backofficelicense = service patchlicensefeatures(id, build); // putting all features from the product on the license list\<licensefeaturepatch> features = product getproductfeatures() stream() map(feature > licensefeaturepatch builder() productfeature(feature getcode()) maxconsumption(feature getmaxconsumption())) map(licensefeaturepatch licensefeaturepatchbuilder build) collect(collectors tolist()); backofficelicense backofficelicensewithfeatures = service patchlicensefeatures(id, patchlicensefeaturesrequest builder() productfeatures(features) build()); assignmultipleusers(long licenseid, assignmultipleusersrequest request) assigns multiple users to a single license if requesting manager has access permissions to it long licenseid = 1234567891011121l; assignuserdata data1 = assignuserdata builder() email("user1\@company com") build(); assignuserdata data2 = assignuserdata builder() email("user2\@company com") build(); assignuserdata\[] userdata = new assignuserdata\[]{data1, data2}; assignmultipleusersrequest request = assignmultipleusersrequest builder() emails(userdata) sendemail(false) build(); list\<multipleassignmentresponse> responses = service assignmultipleusers(licenseid, request); system out println(responses get(0) getemail()); system out println(responses get(0) getnewuser()); system out println(responses get(0) getpassword());long licenseid = 1234567891234567l; // example 1 first time user with only required parameters assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") build(); // response will be "license was successfully assigned and users new password is initial password that server set " // password will be random 8 characters including a z, a z, 0 9, and special characters string response = licenseservice assignuser(licenseid, request); // example 2 first time user with all parameters and set password assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") firstname("john") lastname("doe") phonenumber("000 111 000") ismanager(false) password("password") build(); // response will be "license was successfully assigned and users new password is password " string response = licenseservice assignuser(licenseid, request); // example 3 assigning a user that already exists in the database but changing his password assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") password("password") build(); // response will be license was successfully assigned and users new password is password " string response = licenseservice assignuser(licenseid, request); // example 4 assigning a user that already exists in the databse and not setting the password field assignusertolicenserequest request = assignusertolicenserequest builder() email("someemail\@gmail com") build(); // response will be "license was successfully assigned and user already has a password " string response = licenseservice assignuser(licenseid, request);// this will erase all features on the license long id = 1234567891011121l; patchlicensefeaturesrequest build = patchlicensefeaturesrequest builder() build(); backofficelicense backofficelicense = service patchlicensefeatures(id, build); // putting all features from the product on the license list\<licensefeaturepatch> features = product getproductfeatures() stream() map(feature > licensefeaturepatch builder() productfeature(feature getcode()) maxconsumption(feature getmaxconsumption())) map(licensefeaturepatch licensefeaturepatchbuilder build) collect(collectors tolist()); backofficelicense backofficelicensewithfeatures = service patchlicensefeatures(id, patchlicensefeaturesrequest builder() productfeatures(features) build()); unassignuser(long licenseid, int licenseuserid) unassigns a user from a single license if requesting manager has access permissions to it long id = 1234567891011121l; int userid = 1; string email = "user\@company com"; service unassignuser(id,userid); setuserpassword(int userid, string newpassword) sets the license users password to a new value int userid = 11; string password = "new pass"; licenseservice setuserpassword(userid,password); 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 long id = 1234567891234567l; boolean isdeactivated = licenseservice disablelicense(id)int userid = 11; string password = "new pass"; licenseservice setuserpassword(userid,password); 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 long id = 1234567891234567l; boolean isreset = licenseservice resetlicense(id)) enablelicense(long id) enables the license with the provided id returns detailed license information that is now enabled long id = 1234567891234567l; backofficelicense license = licenseservice enablelicense(id); resettotalconsumptions(long licenseid) resets the total consumptions on the license to zero long id = 1234567891011121l; backofficelicense license = service resettotalconsumptions(id); license custom fields management to manage custom fields on licenses, call licensecustomfieldsservice methods service is available through licenseservice class // save the licensecustomfieldsservice as a separate object licenseservice licenseservice = new licenseservice(configuration); licensecustomfieldsservice cfservice = licenseservice licensecustomfieldsservice() // call the service through licenseservice object = licenseservice licensecustomfieldsservice() method(); 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 // basic request searchlicensecustomfieldsrequest request = searchlicensecustomfieldsrequest builder() build(); searchresult\<backofficelicensecustomfield> response = cfservice search(request); // search by license id long license = 1234567891011121l; searchlicensecustomfieldsrequest request = searchlicensecustomfieldsrequest builder() license(license) build(); searchresult\<backofficelicensecustomfield> response = cfservice search(request); // search with all possible queries long license = 1234567891011121l; searchlicensecustomfieldsrequest request = searchlicensecustomfieldsrequest builder() license(license) 	 limit(5) 	 offset(2) build(); searchresult\<backofficelicensecustomfield> response = cfservice search(request); 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 searchlicensecustomfieldsrequest request = searchlicensecustomfieldsrequest builder() build(); list\<backofficelicensecustomfield> allfields = licenseservice licensecustomfieldsservice() paginate(request); get(integer id) retrieves license custom field data int id = 1; backofficelicensecustomfield field = cfservice get(id); create(createlicensecustomfieldrequest request) creates a new license custom field long license = 1234567891011121l; string value = "value"; int product = 11; createlicensecustomfieldrequest request = createlicensecustomfieldrequest builder() license(license) value(value) productcustomfield(product) build(); backofficelicensecustomfield field = cfservice create(request); update(integer id, updatecustomlicensefieldrequest request) updates the license custom field int id = 6; string value = "value"; updatecustomlicensefieldrequest request = updatecustomlicensefieldrequest builder() value(value) build(); cfservice update(id, request); delete(integer id) deletes the license custom field int id = 12; cfservice delete(id); device management devices can be managed through licenseservice object you can make the licenseservice object by passing the configuration you made before licenseservice service = new licenseservice(configuration); 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 // basic request, gets a list of 20 devices searchdevicesrequest request = searchdevicesrequest builder() build(); // gets the first 10 devices that are blacklisted searchdevicesrequest request = searchdevicesrequest builder() blacklisted(true) limit(10) build(); // lists at most 20 devices that are linked with this license searchdevicesrequest request = searchdevicesrequest builder() license(1234567890101112l) build(); // search by hostname searchdevicesrequest request = searchdevicesrequest builder() 	 hostname("hostname") build(); 	 	 // search by hardware id searchdevicesrequest request = searchdevicesrequest builder() 	 hardwareid("g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1 g1g1") build(); // gets at most 100 devices with an offset equal to 10 and orders them by the license id attribute in ascending order try { 	searchdevicesrequest request = searchdevicesrequest builder() limit(100) orderby("license") offset(10) build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } // lists at most 100 devices that are sorted by the blacklisted in descending order try { 	searchdevicesrequest request = searchdevicesrequest builder() limit(100) orderby("blacklisted") sortdescending(true) build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } list\<device> results = licensesservice searchdevices(request); 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 searchdevicesrequest request = searchdevicesrequest builder() blacklisted(true) build(); list\<device> devices = licenseservice paginatethroughalldevices(request); getdevice(long id) gets the device with the provided id long id = 1000100010010010l; device device = licenseservice getdevice(id); log info(device getos()); log info(device getmacaddress()); log info(device getappver()); log info(device getexternalip()); log info(device getfloatinglastseen()); log info(device gethardwareid()); log info(device gethostname()); log info(device getip()); log info(device getlicense()); log info(device getsdkbuildversion()); log info(device gettype()); log info(device getvminfo()); log info(device getdevicevariables() tostring()); log info(string valueof(device getcreatedat() getyear())); log info(device getid() tostring()); log info(device getlastcheck() tostring()); log info(device gettimeactivated() tostring()); log info(device gettimedeactivated() tostring()); log info(device getupdatedat() tostring()); log info(device getvalidityperiod() tostring()); log info(device isblacklisted() ? "blacklisted" "not blacklisted"); log info(device isdeviceactive() ? "active" "not active"); log info(device isfloatinginuse() ? "in use" "not in use"); log info(device isvm() ? "vm" "not vm"); resetdevice(long id) resets the device long id = 1234567891011121l; service resetdevice(id); blacklistdevice(long id) blacklists the device long id = 1234567891011121l; service blacklistdevice(id); device variables management to manage device variables, call devicevariablesservice methods service is available through licenseservice class // save the devicevariablesservice as a separate object licenseservice licenseservice = new licenseservice(configuration); devicevariablesservice dvservice = licenseservice devicevariablesservice() // call the service through licenseservice object = licenseservice devicevariablesservice() somemethod(); search(searchdevicevariablesrequest request) searches through all device variables and returns the search result which contains all device variables that satisfy the request queries // basic request searchdevicevariablesrequest request = searchdevicevariablesrequest builder() build(); searchresult\<backofficedevicevariable> response = dvservice search(request); // search by id long id = 1234567891011121l; searchdevicevariablesrequest request = searchdevicevariablesrequest builder() device(id) build(); searchresult\<backofficedevicevariable> response = dvservice search(request); // search with all possible queries long id = 1234567891011121l; searchdevicevariablesrequest request = searchdevicevariablesrequest builder() device(id) 	 limit(5) 	 offset(2) build(); searchresult\<backofficedevicevariable> response = dvservice search(request); 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 searchdevicevariablesrequest request = searchdevicevariablesrequest builder() build(); list\<backofficedevicevariable> allfields = licenseservice devicevariablesservice() paginate(request); get(integer id) retrieves device variable data long id = 111l; backofficedevicevariable field = dvservice get(id); create(createdevicevariablerequest request) creates a new device variable long device = 1234567891011121l; string variable = "var"; string value = "val"; createdevicevariablerequest request = createdevicevariablerequest builder() device(device) value(value) variable(variable) build(); backofficedevicevariable backofficedevicevariable = dvservice create(request); update(integer id, updatedevicevariablerequest request) updates the device variable string variable = "var"; string value = "val"; long id = 111l; updatedevicevariablerequest request = updatedevicevariablerequest builder() variable(variable) value(updatedvalue) build(); backofficedevicevariable updatedvariable = dvservice update(id, request); delete(integer id) deletes the device variable long id = 111l; dvservice delete(id); 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 orderservice orderservice = new orderservice(configuration); 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 // basic request without special queries, retrieves a list of 20 orders searchordersrequest request = searchordersrequest builder() build(); // retrieves a list of at most 20 orders under the company with the id 10 searchordersrequest request = searchordersrequest builder() company(10) build(); // request with all possible fields except the orderby searchordersrequest request = searchordersrequest builder() // if you have multiple companies under your control, // you can specify which companies licenses you want to search // by putting in the company code company(10) customercompanyname("company example co ") customercompanynamecontains("example") customeremail("john company\@gmail com") customeremailcontains("company") customeremailstartswith("john") customerid(11) customernamecontains("doe") customerreferencecontains("123") storeid("1234567890101112") storeidcontains("456") storeidstartswith("123") // how many orders you want to be retrieved, deafult is 20 limit(10) // offset from the beggining of the result offset(1) build(); // sorts the orders in ascending order by the field company try { 	searchordersrequest request = searchordersrequest builder() orderby("company") build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } // sorts the orders in descending order by the field customerid try { 	searchordersrequest request = searchordersrequest builder() orderby("customerid") sortdescending(true) build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } searchresult\<order> response = ordersservice searchorders(request); 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 long id = 1234567891234567l; order order = orderservice getorder(id); // there are a lot of fields that can be accessed with a getter // this is just an example of a few of them // we advise you to explore all the fields you can get from the order log info(order getcustomercompany()); log info(order gettype() name()); log info(order getcustomer() getaddress()); log info(order getorderitems() get(0) getproductid()); 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 searchordersrequest request = searchordersrequest builder() company(10) build(); list\<order> orders = licenseservice paginatethroughallorders(request); 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 // example 1 simple order with user based license customer customer = customer builder() email("someemail\@gmail com") build(); userbasedlicense user = userbasedlicense builder() email("anotheremail\@gmail com") build(); orderlicense license = orderlicense builder() licensetype(licensetype consumption) user(user) maxconsumptions(555) consumptionperiod("1m") maxactivations(5) build(); orderitem item = orderitem builder() productcode("pc") license(license) build(); webhookorder order = webhookorder builder() customer(customer) id("my application order reference " + instant now() toepochmilli()) item(item) build(); createorderresponse response = ordersservice createorder(order); log info(response getorderid()); for (userdata data response getnewpasswords()) { log info(data getemail() + " > " + data getnewpassword()); } // example 2 simple key based order customer customer = customer builder() email("someemail\@gmail com") build(); generatelicenserequest params = generatelicenserequest builder() product("pc") quantity(5) build(); string\[] keys = ordersservice generatelicensekeys(params); orderlicense license = orderlicense builder() licensetype(licensetype consumption) maxconsumptions(666) resetconsumption(true) preventvm(true) // identity is either a licenseidentity object or its subclass activationlicense object key(identity getlicensekey()) build(); orderitem item = orderitem builderwith(this consumptionfactory) productcode("pc") generatelicenses(keys) build(); webhookorder order = webhookorder builder() customer(customer) id("my application order reference " + instant now() toepochmilli()) item(item) build(); createorderresponse response = ordersservice createorder(order); log info(response getorderid()); private orderlicense consumptionfactory(licenseidentity identity){ return orderlicense builder() licensetype(licensetype consumption) maxconsumptions(666) allowoverages(true) maxoverages(1666) resetconsumption(true) preventvm(true) key(identity getlicensekey()) build(); } // example 3 this contains all objects needed to create an order // but with more verbose fields than just those that are required customer customer = customer builder() email("someemail\@gmail com") firstname("john") lastname("doe") companyname("company example co ") reference("reference123") phone("09 123 456 789") build(); 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 // product and quantity are both required and only fields generatelicenserequest request = generatelicenserequest builder() product("pc") quantity(5) build(); string\[] keys = orderservice generatelicensekeys(request); system out println(keys); addmanagertoorder(long orderid, addmanagertoorderrequest request) adds a manager to an order addmanagertoorderrequest request = addmanagertoorderrequest builder() email("manager\@company com") password("password") build(); long orderid = 1234567891011121l; manager manager = orderservice addmanagertoorder(orderid, request)); 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 // saves the csv to desktop or home string filepath = orderservice exporttocsv(localdate of(2020, 7, 1), localdate of(2020, 9, 1), null); // saves the csv to custom path string filepath = orderservice exporttocsv(localdate of(2020, 7, 1), localdate of(2020, 9, 1), "home/user/downloads/licensespring"); 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 // saves the csv to desktop or home string filepath = orderservice exporttocsv(range last60, null); // saves the csv to custom path string filepath = orderservice exporttocsv(range last60, "home/user/downloads/licensespring"); product management products can be managed through orderservice object you can make the orderservice object by passing the configuration you made before orderservice orderservice = new orderservice(configuration); 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 // basic request, no fields required, gets at most 20 products because limit is 20 by default searchproductsrequest request = searchproductsrequest builder() build(); // gets at most 40 products that are archived searchproductsrequest request = searchproductsrequest builder() isarchived(true) limit(40) build(); // gets products, sorts them in ascending order by the isarchived field, and then gets 10 products with an offset of 10 try { 	searchproductsrequest request = searchproductsrequest builder() limit(10) offset(10) orderby("is archived") build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } // gets products and sorts them by the isarchived field in descending order and sends back first 20 products try { 	searchproductsrequest request = searchproductsrequest builder() orderby("is archived") sortdescending(true) build(); } catch (licensespringsortingexception e) { log error(e getcause() getmessage()); } searchresult\<backofficeproduct> response = ordersservice searchproducts(request); // there are a lot of read only fields at your disposal, these are just some of them // we encourage you to explore them and see which ones interest you for(backofficeproduct product response getresults()) { log info(product getauthorizationmethod()); log info(product getconsumptionperiod()); log info(product getmaintenanceduration()); log info(product getshortcode()); log info(product getsubscriptionduration()); log info(product getvalidduration()); log info(product getcustomfields()\[0] getname()); } getproduct(long id) gets details about the product with specified id long id = 1234567891234567l; backofficeproduct product = orderservice getproduct(id); // there are a lot of read only fields at your disposal, these are just some of them // we encourage you to explore them and see which ones interest you log info(product getauthorizationmethod()); log info(product getconsumptionperiod()); log info(product getmaintenanceduration()); log info(product getshortcode()); log info(product getsubscriptionduration()); log info(product getvalidduration()); log info(product getcustomfields()\[0] getname()); 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 searchproductsrequest request = searchproductsrequest builder() isarchived(true) build(); list\<backofficeproduct> products = licenseservice paginatethroughallproducts(request); installation file management use orderservice object to manage installation files orderservice orderservice = new orderservice(configuration); searchinstallationfiles(searchinstallationfilesrequest request) searches the installationfiles by applying the filtering and ordering conditions in the searchinstallationfilesrequest class // example of a request with all possible queries searchinstallationfilesrequest request = searchinstallationfilesrequest builder() limit(3) offset(1) product(1234567891011121l) orderby("product") sortdescending(true) build(); list\<backofficeinstallationfile> files = orderservice searchinstallationfiles(request) getresults(); 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 searchinstallationfilesrequest searchrequest = searchinstallationfilesrequest builder() build(); list\<backofficeinstallationfile> products = orderservice paginatethroughallinstallationfiles(searchrequest); getinstallationfile(int id) gets the installation file with the provided id int id = 1; backofficeinstallationfile file = orderservice getinstallationfile(id); createinstallationfile(createinstallationfilerequest request) creates and returns a new installationfile with the details provided in the request long id = 1234567891011121l; createinstallationfilerequest request = createinstallationfilerequest builder() 	// use environment enum for options environment(environment mac) fulllink("https //company com/product") hashmd5("hash") product(id) 	 // needs to be of yyyy mm dd format 	 // will throw exception otherwise releasedate("2021 03 15") version("2 8") build(); backofficeinstallationfile file = orderservice createinstallationfile(request); product custom field management use orderservice productcustomfieldsservice() method to get a service for managing products custom fields // save product custom fields service as an object productcustomfieldsservice pcfservice = orderservice productcustomfieldsservice() // call it directly without saving the object object response = orderservice productcustomfieldsservice() method(); 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 searchproductcustomfieldsrequest request = searchproductcustomfieldsrequest builder() limit(10) product(1234567891011121l) build(); searchresult\<backofficeproductcustomfield> result = orderservice productcustomfieldsservice() search(request); get(integer id) retrieves product custom field data int id = 11; backofficeproductcustomfield backofficeproductcustomfield = pcfservice get(id); create(createproductcustomfieldrequest request) creates a new product custom field long product = 1234567891011121l; string name = "name"; string defaultvalue = "valuebydefualt"; createproductcustomfieldrequest request = createproductcustomfieldrequest builder() product(product) name(name) defaultvalue(defaultvalue) build(); backofficeproductcustomfield field = pcfservice create(request); update(integer id, updateproductcustomfieldrequest request) updates the product custom field string updatedname = "updated name"; string updatedvalue = "updated value"; int id = 18; updateproductcustomfieldrequest request = updateproductcustomfieldrequest builder() name(updatedname) defaultvalue(updatedvalue) build(); backofficeproductcustomfield updatedfield = pcfservice update(id, request); delete(integer id) deletes the product custom field int id = 18; pcfservice delete(id); 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 searchproductcustomfieldsrequest request = searchproductcustomfieldsrequest builder() limit(10) product(1234567891011121l) build(); list\<backofficeproductcustomfield> result = orderservice productcustomfieldsservice() paginate(request);