# How to use updated\_at in Orders-line\_items

**URL:** <https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454>\
**Category:** Getting Started\
**Created:** [April 21, 2023, 7:15pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454 "2023-04-21T19:15:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nareshbiyyam](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nareshbiyyam](https://community.shiphero.com/u/nareshbiyyam)\
**Post date:** [April 21, 2023, 7:15pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/1 "2023-04-21T19:15:19Z")

</div>

Hi Folks, @sh-agent

I have a requirement to pull recently updated line\_items data from Orders API, I see that we have field-updated\_at in line\_items data set, however I’m not able to use that in the query.

Please suggest, how can I use updated\_at to get last updated based on 5Mins ,10Mins etc. time frames?

Note : order\_number value is a dummy value.

Below is the query I’m using.  
query {  
orders(order\_number: “#333”){  
request\_id  
complexity  
data(first: 10) {  
edges {  
node {  
id  
legacy\_id  
order\_number  
shop\_name  
fulfillment\_status  
order\_date  
line\_items {  
edges {  
node{  
id  
sku  
quantity  
price  
product\_name  
fulfillment\_status  
updated\_at  
}  
cursor  
}  
pageInfo {  
hasNextPage  
}  
}  
}  
cursor  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [April 21, 2023, 7:34pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/2 "2023-04-21T19:34:13Z")

</div>

Hey @nareshbiyyam,

Thanks for reaching out and Welcome to our Developer Community!

I don’t believe you’ll be able to filter by line items updated when using the orders query. You can filter by order updated however. If you wanted to get the orders updated within the past 10 minutes, the query would look something like this:

```auto
query {
  orders(updated_from: "2023-04-21 19:20", updated_to: "2023-04-21 19:30") {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          id
          legacy_id
          order_number
          shop_name
          fulfillment_status
          order_date
          line_items {
            edges {
              node {
                id
                sku
                quantity
                price
                product_name
                fulfillment_status
                updated_at
              }
              cursor
            }
            pageInfo {
              hasNextPage
            }
          }
        }
        cursor
      }
    }
  }
}

```

Do note that the Public API operates in UTC.

Please let me know if you have any questions or concerns.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![nareshbiyyam](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nareshbiyyam](https://community.shiphero.com/u/nareshbiyyam)\
**Post date:** [April 21, 2023, 7:40pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/3 "2023-04-21T19:40:41Z")

</div>

Hi @sh-agent

Thanks for your quick response.

Yes, that’s true. If I wants to get the last updated order data, then we can use (updated\_from: “2023-04-21 19:20”, updated\_to: “2023-04-21 19:30” ).

However, If I want to track the last updated Line-Items? Can I use the same condition??

Does that mean - In case of Line-items update also this parameter ( **updated\_from** ) will get’s updated in the system for Orders?

Thank you.

---

<div class="post-metadata">

**Author:** ![nareshbiyyam](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nareshbiyyam](https://community.shiphero.com/u/nareshbiyyam)\
**Post date:** [July 10, 2023, 7:57pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/4 "2023-07-10T19:57:36Z")

</div>

Hi @sh-agent  
Hope you are doing well!

I’m reaching out to you regarding the same issue mentioned you earlier. As you already know we’re trying to consume the Orders - Line items and trying to find a way to bring the delta information which changed over time.

We have implemented this approach for reading Orders data(Only header) and for this **Updated\_at** field is used for **sort** and also we used **endcursor** from the pagination to read the next updated data in Orders dataset. This worked perfectly.

However, same kind of logic we’re trying to implement for Line-Items in Orders dataset. For some reason it’s not working. Please check the below sample GraphQL query we’re using.

query {  
orders(order\_number: “Demo\_Order”) {  
data(sort: “updated\_at”) {  
edges {  
node {  
id  
order\_number  
order\_date  
updated\_at  
line\_items(first: 10, sort: “updated\_at”) {  
edges {  
node {  
backorder\_quantity  
created\_at  
updated\_at  
id  
order\_id  
}  
}  
}  
}  
}  
pageInfo {  
startCursor  
endCursor  
hasNextPage  
hasPreviousPage  
}  
}  
}  
}

 ![image](https://us1.discourse-cdn.com/flex020/uploads/shiphero/original/1X/93205799239349cad6f82413270993e415aed991.png)

Here, Line items updated date is in future compared to the header data and, Order requirement is to get only Line-items data based on **updated\_at** field and **endcursor**.

Could you provide the solution or approach for bringing this data.  
Similar issue we have seen for Purchase Orders and Returns.

Your suggestion would help us to make the better API for orders and also this is very crucial for us. Since we’re stuck at this point.

early response would be appreciated

Thank you.

---

<div class="post-metadata">

**Author:** ![sh-agent](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@sh-agent](https://community.shiphero.com/u/sh-agent)\
**Post date:** [July 11, 2023, 4:02pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/5 "2023-07-11T16:02:14Z")

</div>

Hey @nareshbiyyam,

Thanks for bringing this up.  
Going to work with the team on this one and get back to you.

Please let me know if you have any questions or concerns.

Best,  
RayanP

---

<div class="post-metadata">

**Author:** ![nareshbiyyam](https://avatars.discourse-cdn.com/v4/letter/n/3bc359/32.png) [@nareshbiyyam](https://community.shiphero.com/u/nareshbiyyam)\
**Post date:** [July 11, 2023, 8:13pm UTC](https://community.shiphero.com/t/how-to-use-updated-at-in-orders-line-items/2454/6 "2023-07-11T20:13:17Z")

</div>

Hi @sh-agent

Thank you for your prompt response.

Please keep me updated on the progress and any updates that arise during your collaboration.  
This issue has become a bottleneck for our project, so looking for the solution as soon as possible.

If you have any questions or concerns, please don’t hesitate to reach out. I’m here to provide any assistance or clarification needed.

Thank you.
