Purchase_order_create mutation throws Unexpected Error ("code": 22)

When creating PO we always receive error, maybe someone could explain if I provide wrong data or it’s a bug?:

{ "errors": [ { "message": "Unexpected Error", "operation": "purchase_order_create", "field": "purchase_order_create", "request_id": "5ed0acfbb882e99a82260c77", "code": 22 } ], "data": { "purchase_order_create": null } }

data sent (basic only required fields from given examples):
mutation { purchase_order_create(data:{ po_number: "<unique-po-number>" subtotal: "500" shipping_price: "20" total_price: "420" discount:"100" warehouse_id: "<valid-warehouse-id>" line_items: [ { sku: "<sku-of-existing-product>" quantity: 1 expected_weight_in_lbs: "1.00" price: "50" product_name:"T. Shirt XL Blue 01" } ] }) { request_id } }

Same error when running PO creation code from examples. It works fine with other mutations (order/product).

Hi @Justas
I noticed you were able to create the PO https://app.shiphero.com/dashboard/purchase-orders/details/499922
Are you still seeing this issue?
Thanks in advance!

I was able to create PO via REST old api (https://shipheropublic.docs.apiary.io/#reference/purchase-orders/create-po/create-po),

but when trying to make it with new api graphQL (https://developer.shiphero.com/examples-mutation/#mutationpo) I receive “Unexpected Error”.

I need to upgrade old system, to use graphQL

Hi @tomasw,

any update on this?

Hi @Justas!
I just tried that same Mutation on my account and it went through.
Is it OK if I try with your account and product? and let you know if it comes through?

This is what I tried on my test account:

mutation {
    data: {
      po_number: "20200528000002Test"
      subtotal: "500"
      shipping_price: "20"
      total_price: "420"
      discount: "100"
      warehouse_id: "V2FyZWhvdXNlOjExNzkw"
      line_items: [
          sku: "1122334457"
          quantity: 1
          expected_weight_in_lbs: "1.00"
          price: "50"
          product_name: "Name123"
  ) {

And it did create a PO on my account.
Thanks in advance!

@tomasw still no luck, I used your query with my warehouse id and product sku(existing) .
Could you send me your email that I could send you my account details?

Hi @Justas,
sure!, email me at twingord@shiphero.com