---
id: executing-pass-through-queries-java-sdk
slug: /sdk/java/executing-pass-through-queries-java-sdk
title: 'Executing Pass-Through Queries Java SDK'
description: 'This topic explains how to execute pass through queries in Agility'
sidebar_label: 'Executing Pass-Through Queries'
sidebar_position: 10
tags: ['query-api', 'json-query', 'yaml-format']
---

In addition to providing object model-like access to the Digital.ai Agility Data API, the Java SDK also provides a way to execute queries using the Query API. The Query API provides read-only access to Agility data, and allows you to submit hierarchical queries in a JSON or YAML format. In addition, data returned from the Query API is in a JSON format.

## Executing a JSON Query

In this example, a JSON query is used to get all Story assets with an estimate greater than ten:

```
            String query =
            "{" +
            "  \"from\": \"Story\"," +
            "  \"select\": [\"Name\",\"Number\"]," +
            "  \"filter\": [\"Estimate>'10'\"]," +
            "  \"page\": {\"size\": 50, \"start\": 0}" +
            "}";
        
            String result = services.executePassThroughQuery(query);
            System.out.println(result);
        
```

This is an example ofthe raw JSON data that is returned:

```
            [
            [
            {
            "_oid": "Story:6555",
            "Name": "Test Story on Scope:6527 - Name attribute"
            },
            {
            "_oid": "Story:6588",
            "Name": "Test Story Scope:6527 Query filter with multiple attributes"
            }
            ]
            ]
        
```

## Executing a YAML Query

In this example, a YAML query is used to get all Story assets with an estimate greater than ten, the raw JSON that is returned is the same as when submitting the query in a JSON format:

```
            String query = "from: Story\n" +
            "select:\n" +
            "  - Name\n" +
            "  - Number\n" +
            "filter:\n" +
            "  - Estimate>'10'\n" +
            "page:\n" +
            "  size: 50\n" +
            "  start: 0";
        
            String result = services.executePassThroughQuery(query);
        System.out.println(result);
```
