Skip to content

Decrement

Description

This operation decrements the key's value by a specific number.

Method

PUT

Endpoint URL

Important

Make sure to replace xxxx in the domain name in the request specification below to the one assigned to your application.

https://xxxx.backendless.app/api/hive/[hive-name]/key-value/[key]/decrement?value=[decrement-by]

where:

Argument                Description
[hive-name] Name of a hive where the operation is performed.
[key] Key name identifying a key-value pair.
[decrement-by] A number to decrement the value by.

Request Headers

None.

Request Body

None.

Response Body

Тhe decremented value.

Example

The example below decrements the value associated with the key John by 2.

curl --location --request PUT "https://xxxx.backendless.app/api/hive/workedHours/key-value/John/decrement?value=2"

where:

Argument                Description
workedHours Name of a hive where the operation is performed.
John Key name to decrement the associated value by 2.

Codeless Reference

keyvalue_api_decrement

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a key-value pair.
decrement by Specify a number to decrement the value by.

Returns the decremented value.

Consider the following Key Value storage:

keyvalue_api_example_increment_decrement

The example below decrements the value for the "Apples" key by 2:

keyvalue_api_example_decrement


The key-value storage will look as shown below after the Codeless logic runs:
keyvalue_api_example_decrement_2