# List of returned orders empty when using Python API

**URL:** <https://community.shopify.com/t/list-of-returned-orders-empty-when-using-python-api/13797>\
**Category:** Customers Discounts And Orders\
**Created:** [June 1, 2020, 3:39pm UTC](https://community.shopify.com/t/list-of-returned-orders-empty-when-using-python-api/13797 "2020-06-01T15:39:56Z")\
**Posts on this page:** 3\
**Page:** 1

## AI-generated summary

Python and Node.js API calls to Shopify’s `orders.json` endpoint are returning an empty `orders` array even though orders are visible in the Shopify admin. The main reported symptom is a successful authenticated request (`200 OK`) with a very small response body, indicating no orders were returned.

Key points raised:
- The Python setup successfully creates and activates a Shopify session, but `shopify.Order.find()` returns no results.
- The original poster is confused that opening the same admin API URL in a browser shows data, likely because the browser session is already authenticated in Shopify admin.
- A Shopify response suggests a likely cause: archived orders are excluded by default, so the request may need `status=any` to include all order states.
- If that does not fix it, Shopify support requested the `X-Request-Id` from the response headers for log investigation.
- A second participant reports the same behavior in Node.js and Postman, sharing a request ID and showing a request that uses `selectedView=all`, which still returns an empty array.

Status: unresolved in the thread; `status=any` is the main proposed next step.

<div class="post-metadata">

**Author:** ![devdude](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/devdude/32/250101_2.png) [@devdude](https://community.shopify.com/u/devdude)\
**Post date:** [June 1, 2020, 3:39pm UTC](https://community.shopify.com/t/list-of-returned-orders-empty-when-using-python-api/13797/1 "2020-06-01T15:39:56Z")

</div>

**NOTE:** I have detailed this in a stackoverflow post as well if you would like some internet points: [https://stackoverflow.com/questions/62135563/shopify-api-returns-nothing-when-there-really-is-data](https://stackoverflow.com/questions/62135563/shopify-api-returns-nothing-when-there-really-is-data)

Using the Python shopify API, I create a session and try to fetch all orders for a store. The code looks like this:

```auto
import shopify
import pprint
import logging

logger=logging.getLogger( __name__ )
shopify.Session.setup(api_key=api_key, secret=api_secret)
session = shopify.Session( myshopify_domain, api_version, access_token)
shopify.ShopifyResource.activate_session(session)

for order in shopify.Order.find():
    logger.info(pprint.pformat(order.to_dict()))

```

So shopify API clearly manages to create and use the session to fetch data successfully, as can be gandered from the log output:

```auto
2020-06-01 15:08:47 INFO (MainThread) [pyactiveresource.connection:257::_open()] - GET https://my-store.myshopify.com/admin/api/2020-01/orders.json
2020-06-01 15:08:47 INFO (MainThread) [pyactiveresource.connection:301::_open()] - --> 200 OK 13b

```

However, the returned list of orders is empty (as is also evident by the “13b” in the log).

But when I look in the shopify admin panel for this development store, I have several orders of varying states and with varying data. There should be at least 4 of them submitted within the last week.

And if I just open the URL mentioned in the log [https://my-store.myshopify.com/admin/api/2020-01/orders.json](https://my-store.myshopify.com/admin/api/2020-01/orders.json) (not the real URL) directly in the browser, I also see a bunch of data there.

To me this raises a few questions:

- How come no orders are returned when using the api, even though it seemingly authenticates fine?
- How could I possibly get data when opening the URL in the browser since I have no authentication set up there?

Any hints are welcome. Thanks!

---

<div class="post-metadata">

**Author:** ![\_JB](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/_jb/32/273768_2.png) [@\_JB](https://community.shopify.com/u/_JB)\
**Post date:** [June 2, 2020, 4:35pm UTC](https://community.shopify.com/t/list-of-returned-orders-empty-when-using-python-api/13797/2 "2020-06-02T16:35:00Z")

</div>

Hey @devdude ,

Are you adding any parameters to your call? If those orders in your test store are archived, your GET to the orders endpoint needs to include the param `status=any` to have those orders included in the response.

If the missing parameter isn’t the cause, please send along the X-Request\_Id value found in the response headers for the call, and I can use this to investigate further in our logs.

---

<div class="post-metadata">

**Author:** ![nikhil\_hatcher](https://avatars.discourse-cdn.com/v4/letter/n/45deac/32.png) [@nikhil\_hatcher](https://community.shopify.com/u/nikhil_hatcher)\
**Post date:** [June 9, 2020, 4:20am UTC](https://community.shopify.com/t/list-of-returned-orders-empty-when-using-python-api/13797/3 "2020-06-09T04:20:44Z")

</div>

Hi

Even I’m facing the same issue with node.js request module, I’m using the request module to make a get request on api using access token, even in postman I’m getting empty array,

My reqeust Id is :- fa4a889e-4040-47f2-84d0-ca1f684f4177

My code for accessing shopify api is :

```auto
let orderUrl = shopUrl+`/admin/api/${shopifyApiVersion}/orders.json`;
let queryParams = {'selectedView' : 'all'};
let headers = {'X-Shopify-Access-Token': event.requestAttributes.accessToken}
let orderDetails = await request.get(orderUrl, {headers: headers, qs : queryParams});

```

this is the response I’m getting :

```auto
{
'orders' : []
}

```
