How to set Expiration Date and Expiration Days when issuing licenses via Web Service API? (FAQ146)

How do I set Expiration Date and Expiration Days when issuing a license via the Web Service APIs? Why do I sometimes get the following error “LicenseInfo.Limitations.ExpirationDate and LicenseInfo.Limitations.ExpirationPeriod cannot both be set” error?

Certain combinations of time limitations are not permitted when creating a license e.g. it does not make sense to set an Expiration Date and an Expiration Period at the same time. The former is set explicitly irrespective of when the license is actually activated, whereas the latter is used to calculate the Expiration Date based on an offset from the actual date of activation.

The Software Potential Portal guards against users setting incorrect combinations but when creating licenses using the Web Services API, the Software Potential service will throw an exception if invalid combinations are submitted in a license management CreateLicense or UpdateLicense request.

The following table indicates how to set the different combinations of the License.LicenseInfo.Limitations.ExpirationDate and License.LicenseInfo.Limitations.ExpirationPeriod properties when creating different types of time-limited licenses as well as perpetual/unlimited licenses. (All datetimes should be UTC.)

ExpirationDate            ExpirationPeriod           Result                                                       
Max Value/ A Date  Null+ Error*
Null* Max Value / NumberOfDays Error*
A Date Max Value  / NumberOfDays Error*
A Date -1 OK (Expiration Date specified)
Max Value NumberOfDays (e.g. 30) OK (Expiration Days specified)
Max Value Max Value OK (Unlimited Expiration)

+Null: if don’t populate the field with a value.
* Error: “LicenseInfo.Limitations.ExpirationDate and LicenseInfo.Limitations.ExpirationPeriod cannot both be set” will be returned as an error in Exception

Link to this

FAQ146

You can link to this item directly, using the shorter URL support.inishtech.com/FAQ146.