<BlockSwitcher>
<Block name="Java">

```java
private GraphQLRequest<Todo> getTodoRequest(String id) {
    String document = "query getTodo($id: ID!) { "
        + "getTodo(id: $id) { "
            + "id "
            + "name "
        + "}"
    + "}";
    return new SimpleGraphQLRequest<>(
            document,
            Collections.singletonMap("id", id),
            Todo.class,
            new GsonVariablesSerializer());
}
```

</Block>
<Block name="Kotlin">

```kotlin
private fun getTodoRequest(id: String): GraphQLRequest<Todo> {
    val document = ("query getTodo(\$id: ID!) { "
          + "getTodo(id: \$id) { "
              + "id "
              + "name "
            + "}"
          + "}")
    return SimpleGraphQLRequest(
            document,
            mapOf("id" to id),
            Todo::class.java,
            GsonVariablesSerializer())
}
```

</Block>
</BlockSwitcher>

Then, query for the Todo by a todo id

<BlockSwitcher>
<Block name="Java">

```java
Amplify.API.query(getTodoRequest("[TODO_ID]"),
    response -> Log.d("MyAmplifyApp", "response" + response),
    error -> Log.e("MyAmplifyApp", "error" + error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.API.query(getTodoRequest("[TODO_ID]"),
    { Log.d("MyAmplifyApp", "Response = $it") },
    { Log.e("MyAmplifyApp", "Error!", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
    val response = Amplify.API.query(getTodoRequest("[TODO_ID]"))
    Log.d("MyAmplifyApp", "Query response = $response")
} catch (error: ApiException) {
    Log.e("MyAmplifyApp", "Query failed", error)
}
```

</Block>
</BlockSwitcher>
