Getting 22 error when querying for Warehouse Products

Hello -

I am trying to query warehouse products and when sending my request I am receiving a 22 error. Any chance someone here can help me diagnose?

Query:
query {
warehouse_products {
data(first: 1) {
edges {
node {
id
legacy_id
account_id
warehouse_id
price
value
on_hand
reserve_inventory
allocated
available
created_at
updated_at
}
}
}
}
}

Result:
{
“errors”: [
{
“message”: “Unexpected Error”,
“operation”: “warehouse_products”,
“field”: “data”,
“request_id”: “5e2840334189d00919bd7956”,
“code”: 22
}
],
“data”: {
“warehouse_products”: {
“data”: null
}
}
}

Thank you!
rubix3

Hi @rubix3 !
It looks like you are missing the warehouse on your query. You have to specify this in order to access the products from that warehouse.
It should look something like this:

query {
  warehouse_products(warehouse_id: "V2FyZWhvrfHuNlOjcx21") {
    data(first: 1) {
      edges {
        node {
          id
          legacy_id
          account_id
          warehouse_id
          price
          value
          on_hand
          reserve_inventory
          allocated
          available
          created_at
          updated_at
        }
      }
    }
  }
}

Please let me know if this doesn’t help!
Thanks
Tom

Hello @tomasw -

Thank you! That fix was the reason I was getting the error.

rubix3

1 Like