Increment Int Value

Please log in to get a personalized configuration!

This method will increment the integer value in a Data Object by a certain constant (non-negative). You can always decrement it. Note, this method does not allow integer overflows, i.e. if you increment by a constant that would result in an overflow, an error will be thrown. Note also that you can use the Feature lock in the Access Token to specify the upper bound of the increment constant. So, if you only want to allow incrementing by 1, please set Feature lock field to 1 also. Please see Remarks for more details (including access token set up).

This method is accessed in several ways. Each way works in the same way and requires the same permission. The only difference is the type of parameters. Both cases are listed below:

Parameters

Method 1 (general): https://api.cryptolens.io/api/data/IncrementIntValue
Parameter Description Remarks
Id The unique object id for the data object. required
IntValue The constant int (non-negative) value that should be added to the current IntValue of the data object. For example, if this value is set to 5 and the old IntValue is 1, then the new IntValue will be the old one plus 5, i.e. 6. Note, if you would set this value to -5 instead, the same result would be achieved. optional, 0 by default.
EnableBound If set to true, it will be possible to specify an upper bound. For example, if you set the Bound parameter (below) to 10, you will be able to increment the int value until you reach ten (inclusive). Once the upper bound is reached, an error will be thrown. optional, false by default.
Bound This is the upper bound that will be enforced on the increment operation. It will only be enforced if EnableBound is set to true. Please read the description above. optional, 0 by default.
v Method version. optional. by default, it's 1.
Method 2 (key specific): https://api.cryptolens.io/api/data/IncrementIntValueToKey

There are two ways to call this method:

Parameter Description Remarks
ProductId the product id required
Key the serial key string required
Id The unique object id for the data object. required
IntValue The constant int (non-negative) value that should be added to the current IntValue of the data object. For example, if this value is set to 5 and the old IntValue is 1, then the new IntValue will be the old one plus 5, i.e. 6. Note, if you would set this value to -5 instead, the same result would be achieved. optional, 0 by default.
EnableBound If set to true, it will be possible to specify an upper bound. For example, if you set the Bound parameter (below) to 10, you will be able to increment the int value until you reach ten (inclusive). Once the upper bound is reached, an error will be thrown. optional, false by default.
Bound This is the upper bound that will be enforced on the increment operation. It will only be enforced if EnableBound is set to true. Please read the description above. optional, 0 by default.
v Method version. optional. by default, it's 1.
Parameter Description Remarks
ProductId the product id required
Key the serial key string required
Name The name of the data object. required
IntValue The constant int (non-negative) value that should be added to the current IntValue of the data object. For example, if this value is set to 5 and the old IntValue is 1, then the new IntValue will be the old one plus 5, i.e. 6. Note, if you would set this value to -5 instead, the same result would be achieved. optional, 0 by default.
EnableBound If set to true, it will be possible to specify an upper bound. For example, if you set the Bound parameter (below) to 10, you will be able to increment the int value until you reach ten (inclusive). Once the upper bound is reached, an error will be thrown. optional, false by default.
Bound This is the upper bound that will be enforced on the increment operation. It will only be enforced if EnableBound is set to true. Please read the description above. optional, 0 by default.
v Method version. optional. by default, it's 1.
Method 3 (machine code specific): https://api.cryptolens.io/api/data/IncrementIntValueToMachineCode

There are two ways to call this method:

Parameter Description Remarks
ProductId the product id required
Key the serial key string required
MachineCode the machine code required
Id The unique object id for the data object. required
IntValue The constant int (non-negative) value that should be added to the current IntValue of the data object. For example, if this value is set to 5 and the old IntValue is 1, then the new IntValue will be the old one plus 5, i.e. 6. Note, if you would set this value to -5 instead, the same result would be achieved. optional, 0 by default.
EnableBound If set to true, it will be possible to specify an upper bound. For example, if you set the Bound parameter (below) to 10, you will be able to increment the int value until you reach ten (inclusive). Once the upper bound is reached, an error will be thrown. optional, false by default.
Bound This is the upper bound that will be enforced on the increment operation. It will only be enforced if EnableBound is set to true. Please read the description above. optional, 0 by default.
v Method version. optional. by default, it's 1.
Parameter Description Remarks
ProductId the product id required
Key the serial key string required
MachineCode the machine code required
Name The name of the data object. required
IntValue The constant int (non-negative) value that should be added to the current IntValue of the data object. For example, if this value is set to 5 and the old IntValue is 1, then the new IntValue will be the old one plus 5, i.e. 6. Note, if you would set this value to -5 instead, the same result would be achieved. optional, 0 by default.
EnableBound If set to true, it will be possible to specify an upper bound. For example, if you set the Bound parameter (below) to 10, you will be able to increment the int value until you reach ten (inclusive). Once the upper bound is reached, an error will be thrown. optional, false by default.
Bound This is the upper bound that will be enforced on the increment operation. It will only be enforced if EnableBound is set to true. Please read the description above. optional, 0 by default.
v Method version. optional. by default, it's 1.

Results

Parameter Description Remarks
Result This is either 0(=success) or 1(=error). always returned
Message The message that provides additional information about the result. If it's a successful result, null will be returned. Otherwise, in case of an error, a short message will be returned describing the error. always returned.

Example results

{"result":0,"message":null}

Remarks

  • The sign of the IntValue (incrementing constant) parameter will not be taken into account, i.e. -5 is treated as 5.
  • Integer overflows are not allowed. If you attempt to increment by constant that would result in an integer overflow, an error will be thrown and no changes are going to be made.
  • Feature lock in Access Token can be used as a way to specify the upper bound for the IntValue (incrementing constant). If Feature lock is not 0, the value of the Feature lock will function as an upper bound. So, if you only want to allow incrementing by 1, please set Feature lock to 1
  • The EnableBound option allows you to specify an upper bound for the increment operation. That is, if you want to force this method to stop at 10 (eg. allow a certain feature to be used 10 times), you can specify the Bound to be 10. In this case, when the int value reaches 10, it will no longer be possible to increment the int value. This condition is temporal, i.e. by modifying the upper bound parameter, you can achieve a different upper bound.
  • When accessing the key specific methods (using productId and the key string), you need to either disable key lock (set it to zero) or set it to a negative number, in the same way you would have done if you would have used KeyLock. We recommend to set the KeyLock to -1 when creating the access token.

Errors

Error
Access denied.
The input parameters were incorrect.
Not enough permission.
Not enough permission and/or product not found.
Not enough permission and/or key not found.
Incorrect 'ReferencerType'. It can either be 0 (for a User), 1 (for a Product) and 2 (for a Key).
The increment/decrement value not allowed by security settings.
Cannot increment/decrement value since the limit was reached for an int32.
Not enough permission and/or machine code not found.
;