# Duplicate orders in the orders graphql query

**URL:** <https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304>\
**Category:** GraphQL API\
**Created:** [May 9, 2021, 1:52pm UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304 "2021-05-09T13:52:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dawa](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Dawa](https://community.shiphero.com/u/Dawa)\
**Post date:** [May 9, 2021, 1:52pm UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304/1 "2021-05-09T13:52:43Z")

</div>

Hi,

We are making a query with warehouse\_id and fulfillment\_status query. There are about 2000 rows that match the query.

We do get the data, and using the endCursor to go to to next page with ‘after’ param, we notice that we get a lot of duplicate orders in the next query.

Within a single query, there are no duplicates, but when we use after:, we notice that we are getting duplicates.

How do we fix this ? because we are having to query shiphero many more times to get the full set as it seems there is an issue with cursor on your end.

here is the query we are runnign  
query{  
orders(  
fulfillment\_status: “xxx”,  
warehouse\_id: “yyy”  
){  
complexity  
data {  
pageInfo {  
endCursor  
hasNextPage  
hasPreviousPage  
startCursor  
}  
edges {  
cursor  
node {  
id  
order\_number  
partner\_order\_id  
subtotal  
total\_tax  
total\_discounts  
total\_price   
line\_items(first: 6) {  
pageInfo {  
hasNextPage  
endCursor  
}  
edges {  
node {  
id  
partner\_line\_item\_id  
quantity\_allocated  
locked\_to\_warehouse\_id  
}  
}  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![Dawa](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Dawa](https://community.shiphero.com/u/Dawa)\
**Post date:** [June 25, 2021, 4:56am UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304/2 "2021-06-25T04:56:16Z")

</div>

I am still interested to know how to get around this. We are unable to trust the results from the api because of duplicate orders using ‘after’ param

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [June 25, 2021, 1:40pm UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304/3 "2021-06-25T13:40:11Z")

</div>

Hi Dawa,  
To get a closer look, can you send me a request id? Can you explain a little more what your seeing and what you should be seeing? Apologies, for the time-lapse. Thanks in advance

---

<div class="post-metadata">

**Author:** ![Dawa](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@Dawa](https://community.shiphero.com/u/Dawa)\
**Post date:** [June 25, 2021, 2:02pm UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304/5 "2021-06-25T14:02:47Z")

</div>

Hi Therasa,

We are trying to retrieve all orders in fulfillment\_status ‘x’ that is locked to a warehouse. There are usually more than 100. How do we retrieve all of them ?

When we use the pagination using endCursor to navigate to the next page of result, we see a lot of duplicates. To illustrate what is happening

Let’s say we have 300 orders. Instead of having to do 3 queries with 100 orders each, when we tried this, we had to fetch 6-7 or more times to get all the data where the same orders would show up in multiple pages.

I think the query structure I put in the original question is how we tested.

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [July 9, 2021, 2:29pm UTC](https://community.shiphero.com/t/duplicate-orders-in-the-orders-graphql-query/1304/6 "2021-07-09T14:29:06Z")

</div>

Hi @Dawa!  
We apologize for the delayed response about this.  
Have you tried using date filters (order\_date\_from, order\_date\_to)?

Cursors are dynamic so maybe that might be causing the update on them and the duplicated results.  
Let us know if this still doesn’t help.  
Thanks again for the patience!,  
Tom
