# Data Service Request

> Retrieve the parsed result of a bulk query from the Easyparser Data Service with a GET request and your query ID.

Source: https://docs.easyparser.com/bulk-integration/data-service-request

The Data Service returns the result of each query that the Bulk API accepted. Every accepted input value gets its own query ID in the [Bulk Service Response](/bulk-integration/bulk-service-response) (`data.accepted[].results[].id`). Send that ID to the Data Service to read the query status and the parsed Amazon data.

The webhook sent to your `callback_url` tells you that a query has finished. It does not carry the parsed data, so you always fetch the result from the Data Service.

## Endpoint

Use one of two endpoints:

```http
GET https://data.easyparser.com/v1/queries/{id}
GET https://data.easyparser.com/v1/queries/{id}/results?format=json
```

| Endpoint | Returns |
|---|---|
| `GET /v1/queries/{id}` | The full query record: status, metadata, the original input and, once finished, the parsed result in `json_result`. |
| `GET /v1/queries/{id}/results?format=json` | The query record with the parsed JSON result (no raw HTML) in `json_result`. |

Use the query record when you need to check `status` before reading the data. The [Data Service Response](/bulk-integration/data-service-response) page describes the query record field by field.

## Headers

| Header | Required | Description |
|---|---|---|
| `api-key` | Yes | Your Easyparser API key. `Authorization: Bearer` is not supported. |

You find your API key in the web app under **Account > Plan** at https://app.easyparser.com/account/plan.

## Path parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `id` | string | Yes | Query ID from `data.accepted[].results[].id` in the Bulk Service Response, for example `019efb81-eb45-7e4f-a6a2-9bdcc619921e`. Do not send `bulk_request_id` or `group_id` here. |

## Query parameters

| Parameter | Type | Required | Description |
|---|---|---|---|
| `format` | string | Yes | Output format of the `/results` endpoint. Not used on `GET /v1/queries/{id}`. Allowed: `json`. |

## Example request

The cURL example fetches the query record once. The Node.js and Python examples fetch it and retry every 10 seconds while the status is `pending`. They stop after 30 attempts (5 minutes), the length of the processing timeout.

**cURL**

```bash
curl --location 'https://data.easyparser.com/v1/queries/YOUR_QUERY_ID' \
--header 'api-key: YOUR_API_KEY'
```

**Node.js**

```javascript
// Node.js 18 or later (built-in fetch)
const API_KEY = "YOUR_API_KEY";
const QUERY_ID = "YOUR_QUERY_ID";

async function getQuery(id) {
  const response = await fetch(`https://data.easyparser.com/v1/queries/${id}`, {
    headers: { "api-key": API_KEY },
  });
  return response.json();
}

async function main() {
  for (let attempt = 0; attempt < 30; attempt++) {
    const body = await getQuery(QUERY_ID);
    if (!body.success) {
      console.error("Request failed:", body);
      return;
    }
    if (body.data.status !== "pending") {
      console.log(body.data.status);
      console.log(JSON.stringify(body.data.json_result, null, 2));
      return;
    }
    await new Promise((resolve) => setTimeout(resolve, 10000));
  }
  console.log("Query is still pending.");
}

main().catch(console.error);
```

**Python**

```python
import time

import requests

API_KEY = "YOUR_API_KEY"
QUERY_ID = "YOUR_QUERY_ID"
url = f"https://data.easyparser.com/v1/queries/{QUERY_ID}"

for attempt in range(30):
    response = requests.get(url, headers={"api-key": API_KEY}, timeout=60)
    body = response.json()
    if not body.get("success"):
        print("Request failed:", response.status_code, body)
        break
    status = body["data"]["status"]
    if status != "pending":
        print(status)
        print(body["data"].get("json_result"))
        break
    time.sleep(10)
else:
    print("Query is still pending.")
```

### Get the parsed result

The `/results` endpoint returns the parsed data as JSON, not the raw Amazon HTML. The response is the query record: check `data.status`, then read the data from `data.json_result.result`.

**cURL**

```bash
curl --location 'https://data.easyparser.com/v1/queries/YOUR_QUERY_ID/results?format=json' \
--header 'api-key: YOUR_API_KEY'
```

**Node.js**

```javascript
// Node.js 18 or later (built-in fetch)
const url = "https://data.easyparser.com/v1/queries/YOUR_QUERY_ID/results?format=json";

fetch(url, { headers: { "api-key": "YOUR_API_KEY" } })
  .then((response) => response.json())
  .then((body) => console.log(JSON.stringify(body, null, 2)))
  .catch((error) => console.error(error));
```

**Python**

```python
import requests

url = "https://data.easyparser.com/v1/queries/YOUR_QUERY_ID/results?format=json"
response = requests.get(url, headers={"api-key": "YOUR_API_KEY"}, timeout=60)
print(response.json())
```

## Limits

- **Request rate:** Data Service requests are limited to your plan's Bulk per-minute limit plus 20%. For example, a Bulk limit of 1,000 per minute allows up to 1,200 Data Service requests per minute. The [Account API](/account/account-api) returns your Bulk limit as `minutely_bulk_credit_limit`.
- **Processing timeout:** processing times out after 5 minutes. A query that does not finish in time ends with status `failure`.

> **WARNING:** Results are stored for at most 24 hours and can be removed earlier. Retrieve and store each result on your side as soon as its status is `success`. Once a result is removed, the Data Service returns a not found error for the query (see [Errors](/bulk-integration/data-service-response#errors)).

## Related

- [Data Service Response](/bulk-integration/data-service-response): query record fields, status values and errors
- [Bulk Service Request](/bulk-integration/bulk-service-request): submit a bulk job
- [Bulk Service Response](/bulk-integration/bulk-service-response): where the query IDs come from
- [Bulk API overview](/bulk-integration/overview): how bulk jobs, webhooks and the Data Service fit together
