> For the complete documentation index, see [llms.txt](https://enka-docs.kazury.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enka-docs.kazury.me/api/data.md).

# Data

### Fetching user data

So, with all this out of the way, I will now explain how to fetch data.\
To do this, we simply use the method `fetchGenshinUser(id, ...)`:

```java
api.fetchGenshinUser(722777337, (user) -> {
   final GenshinUserInformation info = user.toGenshinUser();
});
```

{% hint style="warning" %}
&#x20;`GenshinUnconvertedUser` is a class with a lot of nullability.

`GenshinUserInformation`is a class that is being parsed to include nullability&#x20;

&#x20;and handle it.
{% endhint %}

{% hint style="warning" %}
This operation is async and defined code in lambda will be run in some time in the future.
{% endhint %}

***

### Fetching users characters&#x20;

You can loop through the characters that this user has in their showcase.&#x20;

```java
api.fetchGenshinUser(722777337, (user) -> {
    final GenshinUserInformation info = user.toGenshinUser();

    for (GenshinUserCharacter character : info.getCharacters()) {

    }
});
```

{% hint style="warning" %}
`info.getCharacters()`will be empty if:

* User has disabled their showcase
* User has put no characters up for showcase.

&#x20; \=> The loop will not run.
{% endhint %}

***

### Fetching a characters name

To fetch a character name, you can simply get the game data and then invoke `getName`.&#x20;

```java
api.fetchGenshinUser(722777337, (user) -> {
    final GenshinUserInformation info = user.toGenshinUser();

    for (GenshinUserCharacter character : info.getCharacters()) {
        System.out.println(character.getGameData().getName());
    }
});
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://enka-docs.kazury.me/api/data.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
