Errors being received

I’m trying to update orders through the API.
https://shipheropublic.docs.apiary.io/#reference/orders/update-order/update-order

However, every time I make a request to ShipHero api I receive an error.

{
“order_id”: 0,
“message”: “Error updating order”,
“code”: 200,
“response”: “KeyError(‘order_id’,)”
}

This is the payload we are sending to update order endpoint.

{
“token”: “{{shipHeroApiKey}}”,
“order_id”: “104430562”, //shiphero order id
“shipping_address”: {
“province”: “United States”,
“province_code”: “US”,
“city”: “Wilmington”,
“first_name”: “BenTEST”,
“last_name”: “Adams”,
“zip”: “Delaware”,
“country”: “DE”,
“company”: “Advoc8”,
“phone”: “817-549-8352”,
“country_code”: “19804”,
“address1”: “1620 East Ayre Str”,
“address2”: “SUITE #M5318394
}
}

Also tried to send instead of shiphero order id => shiphero order number using rv_ord_BYE1Pft6bk365 but i still receive the same error.

Any ideas?

Also, regarding webhooks. We’ve registered two webhooks.

“Inventory Update” and “Shipment Update”

{
“Message”: “success”,
“code”: “200”,
“webhooks”: [
{
“url”: “{host}/shiphero/inventory_update”,
“source”: “api”,
“name”: “Inventory Update”
},
{
“url”: “{host}/shiphero/shipment_update”,
“source”: “api”,
“name”: “Shipment Update”
}
]
}

However, when account_id (3pl account id) is added, on Order and product create (API) I’m receiving “Inventory Update” but with empty body if we don’t add it to the payload.

When are webhooks triggered? Any idea whats wrong here?

Help is REALLY appreciated.

A few things:
API calls in the legacy API need to be made from the client account. I see you only have a key associated with the 3pl account, that won’t work.

If you are using the ShipHero id, use shiphero_id as the field name. Otherwise if you use the order_id or order_number (in this case, both are rv_ord_BYE1Pft6bk365) the shiop_name of the order needs to match the Shop Name of the API key.

Webhooks need to be registered in the client account.

1 Like

Thank you, will try that and get back.

Hi @yosef,
I generated a new API key in client account
https://nimb.ws/jaIoQr
I registered two webhooks with this key
Inventory Update and Shipment Update
https://nimb.ws/DlmiTZ
But I’m receiving an empty body webhook
https://nimb.ws/hjVruL

Did I registered webhooks right?
Any idea whats wrong here?

Thanks.

Hi @adam,
Thank you for your quick reply.
So, I’m trying to receive the webhooks mentioned above.
Here is a video, of what I’m doing, and how I receive webhooks:
1.Inventory Update https://nimb.ws/wRD7rJ
as you can see, when I change some product fields, shiphero sent an request but with empty body.

2.Shipment Update https://nimb.ws/ULtERs
same as inventory update, I receive an empty request, but its triggered only when we create label for order, is it right?
https://nimb.ws/5h9coE

Thanks.

@varun For the shipment update, try shipping the order from Endeavour (click on the “Pick Pack & Ship” button on the upper right.

Do you have the actual request being received? I see you have a program running that is showing it, but I’d like to see the full request body along with the headers if possible. I’ve tested the webhooks and I’m seeing data.

Hi @yosef,
At the beginning I tried to create orders through Legacy API
The orders were created and I was able to see them in Endeavour dashboard.
https://nimb.ws/caSdzW

After I changed implementation to GraphQl, orders don’t appear anymore in Endeavour dashboard and I’m not really sure why.

If orders don’t appear in Endeavour dashboard does it mean I’m doing something wrong?

this is my Mutation for Order Create

mutation CreateOrder(){
  order_create(
    data: {
      customer_account_id: "QWNjb3VudDo0ODc2"
      order_number: "test-sku-32"
      shop_name: "Dashboard"
      fulfillment_status: "Default"
      order_date: "19-09-19"
      shipping_lines: {
        title: "UPS 3 Day Select"
        price: "0.0"
        method: "UPS"
        carrier: "USPS"
      }
      shipping_address: {
        first_name: "Ben"
        last_name: "Adams"
        address1: "1620 East Ayre Str"
        city: "Wilmington"
        state: "Delaware"
        state_code: "DE"
        zip: "19804"
        country: "United States"
        country_code: "US"
      }
      line_items:[
        {
        sku: "test-sku-3"
        partner_line_item_id: "rv_ord_BYE1Pft6bk3q8yVUr5kC1PQ1y2"
        quantity: 1
        price: "1.00"
        warehouse_id: "V2FyZWhvdXNlOjkxMDI="
      	}
      ]
      email: "smth@example.com"
    }
  ){
    order{
      id
      order_number
    }
  }
}

Not really sure what you meant by the full request body
Inventory update
Body: {}
Header: { "host": "advoc-dev-917790355.us-east-1.elb.amazonaws.com", "accept": "*/*", "accept-encoding": "gzip, deflate", "user-agent": "python-requests/2.20.0", "x-forwarded-for": "54.158.254.66", "x-forwarded-port": "80", "x-forwarded-proto": "http", "content-length": "133", "connection": "keep-alive" }

Shipment update
Body: {}
Header: { "host": "advoc-dev-917790355.us-east-1.elb.amazonaws.com", "accept": "*/*", "accept-encoding": "gzip, deflate", "user-agent": "python-requests/2.9.1", "x-forwarded-for": "54.158.254.66", "x-forwarded-port": "80", "x-forwarded-proto": "http", "content-length": "508", "connection": "keep-alive" }

I temporarily changed the webhook url and made an inventory change - see the request:
http://requestbin.net/r/1l64i8j1?inspect
The body is being sent.

I’ve asked @tomasw to help out with the GraplQL question - he’s going to take a look and get back to you.

Hi @yosef,
Thank you very much for help, I finally understood what is the problem.
Our Express application wasn’t setup to receive raw body request ((
I didn’t thought about it until you sent requestbin url,
I expected to receive application/json.
I think this could be mentioned in documentation for webhooks

@tomasw
I would be grateful for any help.

Hi @varun!
The engineering team just did a fix for this, it should be working now.
Keep in mind that the partner_line_item_id should be unique for each item.
Please let me know if you are still experiencing any issues with it.
Thanks!

Hi @tomasw
Thank you for your quick reply.
I still can’t see orders created with GraphQl in Endeavour dashboard.
In order to test it I created a new order.
I’ve used mutation above, just changed value for some fields

This is response form shiphero

{
  "data": {
    "order_create": {
      "request_id": "5db97e79bc4a30e1f12b5e6d",
      "order": {
        "id": "T3JkZXI6MTA3NTUzNjQw",
        "order_number": "test-sku-43"
      }
    }
  }
}

https://nimb.ws/eVzXm6
As you can see this order is listed in shiphero orders page,
but it’s not listed in Endeavour dashboard
https://nimb.ws/KRhiwu

Thanks.

Hi Varun!
I apologize for that, we had to make another fix for it. I just tested and its working for me.
You can try now and let me know if its still giving you trouble!
Thanks again for the patience,
Tom

Hi @tomasw,
Unfortunately, the orders I create not appear in Endeavour dashboard
Does my mutation for creating orders is right? (the above one)
Maybe I’m not sending some fields or maybe I’m sending some wrong values…
Could you send your mutation for Order Create which worked for you?

Not sure why but when I created orders through the Legacy API
I was able to click on product sku https://nimb.ws/d54k1Y
For Orders created through GraphQL API, sku is not anymore a link
https://nimb.ws/48yEW0 even if we have this product https://nimb.ws/9x3KA6
Is it ok?

One more question is How many requests I can do through GraphQL in short period of time?

I’m trying to create multiple orders almost at the same time,
even if I still have credits and I have a 5 seconds time out between requests I’m receiving this error

{
  "response": {
    "error": "{\"message\": \"Too Many Requests\"}",
    "status": 429
  },
  "request": {
    "query": "*order_create_mutation*"
  }
}

Thanks.

I apologize for this back and forth @varun! We’ve been experiencing some issues lately.

You should be able to do it now, and the mutation should look something like this (this worked for me):

mutation {
  order_create(
    data: {
      order_number: "Order1234"
      order_date: "2019-10-31"
      shipping_address: {
    first_name: "Ben"
    last_name: "Adams"
    address1: "1620 East Ayre Str"
    city: "Wilmington"
    state: "Delaware"
    state_code: "DE"
    zip: "19804"
    country: "United States"
    country_code: "US"
  }
      line_items: [
        {
          sku: "SKU1234"
          product_name: "TEST-SKU"
          quantity: 1
          price: "0.00"
          partner_line_item_id: "50753951"
          fulfillment_status: "pending"
        }
      ]
      shipping_lines: {
        method: "Parcel Plus Expedited"
        carrier: "DHL eCommerce"
        price: "0.00"
        title: ""
      }
      profile: "Manual Orders"
      customer_account_id:"QWNjb3VudDoINTA0"
    }
  )
{
  request_id
  complexity
  order{
    id
    legacy_id
    order_number
    partner_order_id
    shop_name
    fulfillment_status
    order_date
    total_tax
    subtotal
    total_discounts
    total_price
    auto_print_return_label
    custom_invoice_url
    account_id
  }
}}

Let me know if you can create it successfully, and if not, send the order_id created, and I’ll take another look at it.
Thanks again for the patience!
Tom

Hi @tomasw,
I just tried the mutation, looks like It’s working now
https://nimb.ws/2MROQK
Thank you very much!!!

What about SKU and Too Many Requests error (I asked about it above)?
or It will be better to create a new topic for them?

Great! I’m glad it worked

That looks like an error from auth0, by any chance are you requesting tokens frequently on a loop or something like that?

HI @yosef,
Not sure if it’s a issue or not,
When I Print Packing Slip & Label from Endeavour dashboard
order become fulfilled but I don’t receive webhook.
When I ship Order from app dashboard I receive it.
https://nimb.ws/HhzVcA

HI,
I’m a little bit late on the conversation but really interested in knowing a little bit more on how you fixed this issue. I have been having the same issue as @varun on the inventory update.

image