This how-to fetches all Metadata on a specific Leaderboard by using tags.
Prerequisites
- Unity, Unreal, or Godot SDK installed and configured in your project (not required for REST).
- An active Player session (see Authentication).
- A feature with at least one type of Metadata configured (see Add Metadata in Console).
Fetch Metadata by Tags
When fetching Metadata by tags, provide three things:
- A
ulid: the ID of the item to fetch Metadata for. This can be retrieved through the Web Console or in the SDKs, depending on the feature.- For example:
01J96M0BX1GGTPP2QDRCBV3FW2
- For example:
- The tags: of the desired Metadata.
- For example:
warrior, global
- For example:
- A source type: one of the following: Progression, Leaderboard, Catalog Item, or Currency.
A key can also be added, but it supersedes the tags — if you want to search by tags, it's best to avoid using keys and vice versa. Fetching by tags returns all Metadata on that object with the same corresponding tag(s).
// Available sources are: reward, leaderboard, catalog_item, progression, currency,LootLockerMetadataSources sourceType = LootLockerMetadataSources.progression;
// The ulid of the source you are trying to fetch metadata forstring sourceID = "01J96M0BX1GGTPP2QDRCBV3FW2";
// The tags of the metadata that you want to fetchstring[] tags = {"warrior", "global" };
// Base64 can be set to content_type 'application/x-redacted', use this to avoid accidentally fetching large data filesbool ignoreFiles = true;
LootLockerSDKManager.ListMetadataWithTags(sourceType, sourceID, tags, (response) =>{ if (response.success) { // If it succeeded, display all fetched metadata in the console Debug.Log("Metadata result:"); foreach (var entry in response.entries) { string value = ""; Debug.Log(entry.key+": "+entry.TryGetValueAsString(out value)); } } else { // If it failed, output the error to the console Debug.Log(response.errorData.message); }}, ignoreFiles);Coming soon — this sample hasn't been written yet. In the meantime, refer to the Reference Documentation for this endpoint.
Coming soon — this sample hasn't been written yet. In the meantime, refer to the Reference Documentation for this endpoint.
curl -X GET 'https://api.lootlocker.io/game/metadata/source/catalog_item/id/{ulid}?tags={tags}&ignore_files={bool}' \ -H 'x-session-token: your_token_here' \Conclusion
You've fetched multiple Metadata entries created in the Web Console by using tags. You can also fetch a single Metadata entry or Metadata from multiple sources at once.