How to recive purchase order updates through API?

how do I get all updated/fulfilled purchase orders from last one hour? From the below API, I don’t see any “updated_at” query params

purchase_orders(
sku: String
warehouse_id: String
created_from: ISODateTime
created_to: ISODateTime
po_date_from: ISODateTime
po_date_to: ISODateTime
customer_account_id: String
analyze: Boolean
):

Please help. Thanks!!!

Hi @kalesha!
We don’t have that field available at the moment for filtering, would using the PO Update Webhook work for you?

Hi Tomas, thanks for replying my query. But according to the documentation -

Although it is not often, it is possible for a webhook not to fire, and that is why your app should not rely just on receiving data from our webhooks.
The webhook delivery is not always guaranteed, so we strongly suggest implementing reconciliation jobs to periodically fetch data from ShipHero.
Our most important Queries have both the created_at_min and updated_at_min filter parameters., which will allow you to build a job that fetches all resources that have been created or updated since the last time the job ran.

How do we make reconciliation jobs for purchase orders?

Hi @kalesha!
In that case, you would need to fetch the POs and check if there have been any changes to the status of the Purchase Order compared to what you have on your system.
For example, for all the POs that are not Closed, or Canceled on your system you could Query to get the current status or quantities and if it is not the same as what you have on your system, update it to the new value.
Let me know if that doesn’t help or I could explain better.
Thanks again!
Tom

Hi Tomas,

Unfortunately as a middleware developer I don not maintain target system data (like how many pos processed for the day). It doesnt work for me.

Only reason we opt for webhooks is, there is no feasibly from po query to find out updated pos. I can not query all the active pos in the system and compare against target system. It is really painful as a developer with these many limitations on your system.

Anyway can you help me with this situation-
I would need a feasibly in po query to get updated pos (or) give an assurance from your system that webhooks deliver all the updates to the subscriber?

Hi @kalesha!

Webhooks should work for that purpose, they should not fail, and if they do we should fix that, we do suggest doing some kind of reconciliation jobs, for example, fetching updates for the POs that you have in your system that is still pending (which should not be much and should not consult many credits), would you be able to share a request_id linked to your customer’s account? that way I could see how many POs are regularly and help paint a picture of the credit consumption it will require?
Thanks again!
Tom

Thanks @tomasw
Please ref request id: 5fb38e97702019a684311ba7

Can you give me an example query for reconciliation of purchase order.

Thanks,
Kalesha

Hi @kalesha!
Thanks for that information!
In that case, I see you have 103 pending POs, all of them with not more than 5 line items. Bue let’s assume you have 100 items on the PO. In that case, you will only need a Query to check for those POs their status, and all of their line items, and you will need it to run it twice.
The first response will contain 100 POs and the second the remaining 3.

The Query is the following:

query {
  purchase_orders {
    request_id
    complexity
    data(first: 100) {
      pageInfo {
        hasNextPage
        endCursor
      }
      edges {
        node {
          id
          legacy_id
          po_number
          account_id
          warehouse_id
          vendor_id
          created_at
          po_date
          date_closed
          fulfillment_status
          po_note
          line_items(first: 10) {
            pageInfo {
              hasNextPage
              endCursor
            }
            edges {
              node {
                id
                legacy_id
                po_id
                account_id
                warehouse_id
                vendor_id
                po_number
                sku
                vendor_sku
                product_id
                variant_id
                quantity
                quantity_received
                quantity_rejected
                price
                product_name
                option_title
                expected_weight_in_lbs
                fulfillment_status
                sell_ahead
                note
                partner_line_item_id
                barcode
                updated_at
                created_at
              }
              cursor
            }
          }
        }
        cursor
      }
    }
  }
}

For the second response, you will need to paginate using the cursor on the PO section.

Let me know if that still doesn’t help.
Thanks again!
Tom

Hi Tomas,
Thanks for replying. Im in the process of implementing po webhook and I found that “rejectedquantity” and "vendor_sku"is not there in po sample( Webhooks – Developer Resources | ShipHero . How do we get our desired fields in po webhook call?

Thanks,
-Kalesha

Hi @kalesha!
That is correct, that data is not sent with the webhook.
A possible workaround for that would be to send this query back when you receive the webhook notification:

query{
  purchase_order(id:"569020"){
    request_id
    complexity
    data{
      line_items(first:10){
        edges {
          node {
            quantity
            quantity_received
            quantity_rejected
            vendor_sku
          }
        }
      }
    }
  }
} 

Which will provide you of the details you need.

Let me know if this wont work for you.
Thanks in advance!
Tom

Hi Tomas,

While registering for webhook in shiphero, i got “po update” webhook already exists. There are more than one partner using shiphero.
My questions are,

  1. Can i register more than on (same) webhook?
  2. Are these webhooks linked to wholes shiphero account or developer key?

Because we wanted to have exclusive access to our webhooks, and we dont want others to update/delete our configurations.

thanks.

Hi @kalesha!
You can only have one webhook per account (one of each type).

For example:

You can have 1 po_update webhook and 1 shipment_update webhook
But you cannot have 2 po_update webhooks registered to that same account

Let me know if that might sound confusing or I could explain better.
Thanks again!
Tom