# How to recive purchase order updates through API?

**URL:** <https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938>\
**Category:** GraphQL API\
**Created:** [November 8, 2020, 7:28am UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938 "2020-11-08T07:28:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [November 8, 2020, 7:28am UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/1 "2020-11-08T07:28:23Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [November 9, 2020, 2:37pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/2 "2020-11-09T14:37:53Z")

</div>

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

> **[Webhooks – Developer Resources | ShipHero](https://developer.shiphero.com/webhooks/)**

---

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [November 16, 2020, 8:05am UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/3 "2020-11-16T08:05:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [November 16, 2020, 12:48pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/4 "2020-11-16T12:48:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [November 16, 2020, 4:29pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/5 "2020-11-16T16:29:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [November 16, 2020, 7:15pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/6 "2020-11-16T19:15:01Z")

</div>

Hi @kalesha!

> [@kalesha](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [November 17, 2020, 8:51am UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/7 "2020-11-17T08:51:42Z")

</div>

Thanks @tomasw  
Please ref request id: 5fb38e97702019a684311ba7

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

Thanks,  
Kalesha

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [November 17, 2020, 12:51pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/8 "2020-11-17T12:51:15Z")

</div>

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](https://developer.shiphero.com/graphql-primer/#pagination) on the PO section.

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

---

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [December 5, 2020, 8:34am UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/9 "2020-12-05T08:34:16Z")

</div>

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](https://developer.shiphero.com/webhooks#po-update-webhook) . How do we get our desired fields in po webhook call?

Thanks,  
-Kalesha

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [December 7, 2020, 1:09pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/10 "2020-12-07T13:09:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kalesha](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kalesha](https://community.shiphero.com/u/kalesha)\
**Post date:** [December 9, 2020, 5:49pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/11 "2020-12-09T17:49:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [December 9, 2020, 6:19pm UTC](https://community.shiphero.com/t/how-to-recive-purchase-order-updates-through-api/938/12 "2020-12-09T18:19:41Z")

</div>

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
