How to use updated_at in Orders-line_items

Hi Folks, @Rayanp

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
}
}
}
}

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:

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

Hi @Rayanp

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.