Skip to content

Length

Description

This operation returns the number of items in the sorted set.

Method

GET

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]/sorted-set/[key]/length

where:

Argument                Description
[hive-name] Name of a hive where the operation is performed.
[key] Key name identifying a sorted set.

Request Headers

None.

Request Body

None.

Response Body

The total number of elements stored in the sorted set.

Example

The example below returns the number of items in the sorted set:

curl --location --request GET "https://xxxx.backendless.app/api/hive/leaderboard/sorted-set/players/length"

where:

Argument                Description
leaderboard  Name of a hive where the operation is performed.
players Key name identifying a sorted set.

Codeless Reference

sorted_set_api_get_key_values_count

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a sorted set.

Returns the total number of elements stored in the requested sorted set.

Consider the following Sorted Set storage:
sorted_set_api_example_all_blocks

The example below returns the number of items stored in the "players".
sorted_set_api_example_get_key_values_count


The output will look as shown below after the Codeless logic runs.
sorted_set_api_example_get_key_values_count._2