# API calls with a GET command returns empty records

**URL:** <https://forums.knack.com/t/api-calls-with-a-get-command-returns-empty-records/14231>\
**Category:** Ask Developers\
**Created:** [May 10, 2023, 3:24pm UTC](https://forums.knack.com/t/api-calls-with-a-get-command-returns-empty-records/14231 "2023-05-10T15:24:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NormandDefayette\_CortexRD](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/normanddefayette_cortexrd/32/855_2.png) [@NormandDefayette\_CortexRD](https://forums.knack.com/u/NormandDefayette_CortexRD)\
**Post date:** [May 10, 2023, 3:24pm UTC](https://forums.knack.com/t/api-calls-with-a-get-command-returns-empty-records/14231/1 "2023-05-10T15:24:18Z")

</div>

I’ve come across a few instances where I do a simple GET API call on a grid and it returns nothing, i.e. **records: []**.

This is the test code I use. It simply finds the first table in the page and returns the data from its first record.

```auto
const sceneKey = Knack.router.current_scene_key;
const viewId = document.querySelector('.kn-table.kn-view').id;
const recId = document.querySelector('#' + viewId + ' .kn-table-table tbody tr').id;
console.log('sceneKey =', sceneKey);
console.log('viewId =', viewId);
console.log('recId =', recId);

var apiURL = 'https://api.knack.com/v1/pages/' + sceneKey + '/views/' + viewId + '/records/' + recId;
$.ajax({
    url: apiURL,
    type: 'GET',
    headers: {
        'Authorization': Knack.getUserToken(),
        'X-Knack-Application-Id': Knack.application_id,
        'X-Knack-REST-API-Key': 'knack',
        'Content-Type': 'application/json',
    },
    success: function (data) {
        console.log('Success:', data);
    },
    error: function (response) {
        console.log('Error:', response);
    },
});

```

When I run this in the console window of various pages, apps and accounts, I get normal results most of the time, but sometimes I get the zero output bug in about 10% of the cases.

Does anyone have this problem also, and is there a pattern? So far I see nothing special with those views.

This prevents the **KTL’s Bulk Edit** feature to work properly for some users.

Normand

---

<div class="post-metadata">

**Author:** ![Neil1](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Neil1](https://forums.knack.com/u/Neil1)\
**Post date:** [August 19, 2024, 10:19am UTC](https://forums.knack.com/t/api-calls-with-a-get-command-returns-empty-records/14231/2 "2024-08-19T10:19:27Z")

</div>

Hi Normand.  
Did you ever find a resolution to this? I’m experiencing a similar problem.  
Kind regards,  
Neil.
