Start Trial

edit

Execution

edit

This API creates and enables a trial license using the startTrial() method.

StartTrialRequest request = new StartTrialRequest(true); 

StartTrialResponse response = client.license().startTrial(request, RequestOptions.DEFAULT);

Sets the "acknowledge" parameter to true, indicating the user has acknowledged that starting a trial license may affect commercial features

Response

edit

The returned StartTrialResponse returns a field indicating whether the trial was started. If it was started, the response returns a the type of license started. If it was not started, it returns an error message describing why.

Acknowledgement messages may also be returned if this API was called without the acknowledge flag set to true. In this case you need to display the messages to the end user and if they agree, resubmit the request with the acknowledge flag set to true. Please note that the response will still return a 200 return code even if it requires an acknowledgement. So, it is necessary to check the acknowledged flag.

boolean acknowledged = response.isAcknowledged();                              
boolean trialWasStarted = response.isTrialWasStarted();                        
String licenseType = response.getLicenseType();                                
String errorMessage = response.getErrorMessage();                              
String acknowledgeHeader = response.getAcknowledgeHeader();                    
Map<String, String[]> acknowledgeMessages = response.getAcknowledgeMessages(); 

Whether or not the request had the acknowledge flag set

Whether or not this request caused a trial to start

If this request caused a trial to start, which type of license it registered

If this request did not cause a trial to start, a message explaining why

If the user’s request did not have the acknowledge flag set, a summary of the user’s acknowledgement required for this API

If the user’s request did not have the acknowledge flag set, contains keys of commercial features and values of messages describing how they will be affected by licensing changes as the result of starting a trial

Asynchronous execution

edit

This request can be executed asynchronously:

client.license().startTrialAsync(request, RequestOptions.DEFAULT, listener);

The asynchronous method does not block and returns immediately. Once it is completed the ActionListener is called back using the onResponse method if the execution successfully completed or using the onFailure method if it failed.

A typical listener for StartTrialResponse looks like:

ActionListener<StartTrialResponse> listener = new ActionListener<StartTrialResponse>() {
    @Override
    public void onResponse(StartTrialResponse response) {
        
    }

    @Override
    public void onFailure(Exception e) {
        
    }
};

Called when the execution is successfully completed. The response is provided as an argument

Called in case of failure. The raised exception is provided as an argument