Skip to content

Get Score

Description

This operation returns the score of a value from a sorted set.

Method

POST

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]/get-score 

where:

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

Request Headers

Content-Type:application/json

where:

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.

Request Body

A JSON object with the structure shown below:

{  
    "value": [item]  
}

where:

Argument                Description
[item] A value to get the score for.

Response Body

The score of the specified item. Otherwise, returns null if the specified key or the value in the sorted set does not exist.

Example

The example below returns the score of the "JoeTheGamer" item from the leaderboard sorted set.

curl --location --request GET "https://xxxx.backendless.app/api/hive/demoHive/sorted set/leaderboard/get-score" \  
        --header 'Content-Type: application/json \  
        --data-raw '[  
            "value": "JoeTheGamer"  
        ]'

where:

Argument                Description
demoHive  Name of a hive where the operation is performed.
leaderboard  Key name of a sorted set where to get the score for the specified value.
"JoeTheGamer" Value to get the score of.

Codeless Reference
sorted_set_api_get_score

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a sorted set.
value Value to get the score of.

Returns the score of an item. Returns null if the value does not exist in the sorted set.

Consider the following Sorted Set storage:
sorted_set_api_example_all_blocks

The example below retrieves the score of a value "Julia" from the "players" sorted set:
sorted_set_api_example_get_score

The output will look as shown below after the Codeless logic runs:
sorted_set_api_example_get_score_2