Here is the same issue for another account:
Query:
query {purchase_order(id:“UHVyY2hhc2VPcmRlcjo2MDA4ODY”) {data {id,po_number,vendor_id, vendor {id, legacy_id, name, email} } } }
Hi @sb2020!
That is because the Vendor name or id should be fetched at a line item level because the PO could have more than one vendor associated.
You could use for example this Query:
query {
purchase_order(id: "UHVyY2hhc2VPcmRlcjo2MDA4ODY=") {
data {
id
po_note
description
legacy_id
po_number
partner_order_number
line_items {
edges {
node {
vendor {
id
name
}
}
}
}
}
}
}
Let me know if that doesn’t help,
Thanks in advance!
Tom
Could you please also check why we received errors in the query response:
“errors”:[{“message”:“Unexpected Error”,“operation”:“purchase_order”,“field”:“id”,“request_id”:“5f9a78cee487d94c76c21242”,“code”:22}]
And then it tries to pull a vendor from your account with id = 0. But as it doesn’t exist, it returns the error.
I have already reported this for our engineers to fix, but in the meantime you could avoid sending vendor or vendor id at a Purchase Order level, but send it on the Line Item level, like this:
query {
purchase_order(id: "UHVyY2hhc2VPcmRlcjo2MDA4ODY=") {
data {
id
po_note
description
legacy_id
po_number
partner_order_number
line_items {
edges {
node {
vendor {
id
name
}
}
}
}
}
}
}
In order to avoid the unexpected error.
Thanks again!
Tom