About the GraphQL API category

Have a request or suggestion for our technical team?

Hi, I am working with GraphQL API and need the field ‘sale in last 30 (or 7) days’ for each product in the inventory. Is it comming in the future ?

thanks

Hi @khanhnc46 !
Would a query like this one work for you?:

query {
  inventory_changes(
    sku: "testingSKU"
    date_from: "2020-01-01"
    date_to: "2020-02-01"
  ) {
    request_id
    complexity
    data(first: 10) {
      edges {
        node {
          user_id
          account_id
          warehouse_id
          sku
          previous_on_hand
          change_in_on_hand
          reason
          created_at
        }
      }
    }
  }
}

And in the reason field you should see if it was shipped on an order or it’s inventory was manually changed, for example:

“reason”: “Order <a href=”/dashboard/orders/details/1111111">#MO706 shipped"

Let me know if this doesn’t help!
Thanks,
Tom

Hi @tomasw !

that helps, only thing is I have to go through every product and apply that query for each.

Thanks.

1 Like