# Fetch a Single Metadata In-Game

In this How-to, we will fetch a single metadata entry from a leaderboard and output it to the console.

## Prerequisites

* [A LootLocker account and a created game](https://lootlocker.com/sign-up)
* [A feature with at least one type of metadata](https://docs.lootlocker.com/shared-systems/metadata/how-to/add-metadata-in-console)
* [An active Game Session](https://docs.lootlocker.com/players/authentication)

## Fetching Metadata

When fetching a single metadata, you need to provide 3 things:

* **A `ulid`**: (can be retrieved through the [web console](https://console.lootlocker.com) or in the [SDK's](https://docs.lootlocker.com/the-basics/sdks) depending on the feature) of the item to fetch metadata for
  * For example: `01J96M0BX1GGTPP2QDRCBV3FW2`
* **A key**: of the desired metadata
  * For example: `icon`
* **A source type**
  * One of the following: [Progression](https://docs.lootlocker.com/game-systems/progressions), [leaderboard](https://docs.lootlocker.com/game-systems/leaderboards), [catalog\_item](https://docs.lootlocker.com/commerce/catalogs), [currency](https://github.com/lootlocker/gitbook-sync/blob/main/commerce/currencies.md)

## Fetching the metadata

When fetching the metadata by key, you simply call the function and display or handle the data.

{% tabs %}
{% tab title="Unity" %}

```csharp
// Available sources are: reward, leaderboard, catalog_item, progression, currency,
LootLockerMetadataSources sourceType = LootLockerMetadataSources.leaderboard;

// The ulid of the source you are trying to fetch metadata for
string sourceID = "01J96M0BX1GGTPP2QDRCBV3FW2";

// The key of the source that you want to fetch
string key = "info";

// Base64 can be set to content_type "application/x-redacted", use this to avoid accidentally fetching large data files
bool ignoreFiles = true;
LootLockerSDKManager.GetMetadata(sourceType, sourceID, key, (response) =>
{
    if(response.success)
    {
        // If it succeeded, dispaly the fetched metadata in the console
        string value = "";
        response.entry.TryGetValueAsString(out value);
        Debug.Log("Metadata result:"+ value);
    }
    else
    {
        // If it failed, output the error to the console
        Debug.Log(response.errorData.message);
    }
}, ignoreFiles);
```

{% hint style="info" %}
Check out our [SDK](https://docs.lootlocker.com/the-basics/unity-quick-start) for more ways of handling the received metadata entries.
{% endhint %}
{% endtab %}

{% tab title="Unreal" %}

### Coming soon

{% endtab %}

{% tab title="REST" %}

```bash
curl -X GET 'https://api.lootlocker.io/game/metadata/source/catalog_item/id/{ulid}?key={value}&ignore_files={bool}' \
    -H 'x-session-token: your_token_here' \
```

{% endtab %}
{% endtabs %}

## Conclusion

In this How-to we’ve fetched a single metadata entry that was created in the [web console](https://console.lootlocker.com). Apart from getting just one single data entry with metadata, you also have the possibility to Fetch metadata in game by [tags](https://docs.lootlocker.com/shared-systems/metadata/how-to/fetch-metadata-in-game-by-tags) or fetch metadata in game from [multiple sources](https://docs.lootlocker.com/shared-systems/metadata/how-to/fetch-metadata-in-game-from-multiple-sources).
