# Rest api on sql and job

**URL:** <https://community.dremio.com/t/rest-api-on-sql-and-job/1663>\
**Category:** Uncategorized\
**Created:** [August 21, 2018, 7:08pm UTC](https://community.dremio.com/t/rest-api-on-sql-and-job/1663 "2018-08-21T19:08:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![trang](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@trang](https://community.dremio.com/u/trang)\
**Post date:** [August 21, 2018, 7:08pm UTC](https://community.dremio.com/t/rest-api-on-sql-and-job/1663/1 "2018-08-21T19:08:16Z")

</div>

How can I pull back more than 500 rows on the rest api post and get? I did:

```auto
POST /api/v3/sql

```

with a sql that returns over 10000 rows, but after getting that job id and do a get

```auto
GET /api/v3/job/{id}/results?offset={offset}&limit={limit}

```

I only have a result set of 500

---

<div class="post-metadata">

**Author:** ![swarren](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/swarren/32/586_2.png) [@swarren](https://community.dremio.com/u/swarren)\
**Post date:** [August 22, 2018, 12:35am UTC](https://community.dremio.com/t/rest-api-on-sql-and-job/1663/2 "2018-08-22T00:35:24Z")

</div>

The limit can’t be set higher then 500. However, you can repeatedly call the results endpoint by increasing the offset by the limit for each call until you’ve read all the data.

---

<div class="post-metadata">

**Author:** ![doron](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/doron/32/294_2.png) [@doron](https://community.dremio.com/u/doron)\
**Post date:** [August 22, 2018, 3:20pm UTC](https://community.dremio.com/t/rest-api-on-sql-and-job/1663/3 "2018-08-22T15:20:45Z")

</div>

We on purpose limit to 500 at a time as asking for a lot of rows at once can lead to performance issues. If you need to fetch large result sets we recommend using jdbc/ODBC as those are much more performant for that.

---

<div class="post-metadata">

**Author:** ![Basapuram\_Kumar](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/basapuram_kumar/32/4123_2.png) [@Basapuram\_Kumar](https://community.dremio.com/u/Basapuram_Kumar)\
**Post date:** [May 23, 2022, 7:07am UTC](https://community.dremio.com/t/rest-api-on-sql-and-job/1663/4 "2022-05-23T07:07:19Z")

</div>

If we want to get all rows from the data set using below,  
`GET /api/v3/job/{id}/results?offset={offset}&limit={limit}`

This API supports to download only 500 records.  
[https://docs.dremio.com/software/rest-api/jobs/get-job/#syntax](https://docs.dremio.com/software/rest-api/jobs/get-job/#syntax)

It would be best if you used the pagination to fetch in all rows  
Example:  
To get the first 500 rows,

```auto
curl 'http://localhost:9047/api/v3/job/1d74d555-f5eb-eb33-ec67-a0c06d885000/results?offset=0&limit=500' \

```

To get the next set of 500 rows,

```auto
curl 'http://localhost:9047/api/v3/job/1d74d555-f5eb-eb33-ec67-a0c06d885000/results?offset=500&limit=500' \

```

likewise, you need to increase offset value.

```auto
offset=1000&limit=500
offset=1500&limit=500
..
..

```

```auto
curl 'http://localhost:9047/api/v3/job/1d74d555-f5eb-eb33-ec67-a0c06d885000/results?offset={StartOffset}&limit=500' \

```

Hope the above steps are helpful.
