Inventory Update

Hi all,

I’m new to this forum, and new to GraphQL in general. I have an existing process using the legacy API that querys ShipHero for all of the inventory quantities and bins, then querys our warehouse management system and compares the two. It then updates the inventory bin and quantity in ShipHero for any differences it finds. Basically, it keeps ShipHero in sync with our WMS.

I’ll eventually have to re-do this process with the new API once the legacy API is completely depricated, but I’m having trouble finding documentation on how to do this. So far, I’ve managed to get an access token, but I can’t figure out how to use it. I’ve found a couple of posts that suggest using Altair to play around with, so that’s what I’m doing. They say that there’s docs in there, but I can’t find them. There’s a “docs” button, but it doesn’t pull up any docs:

There’s probably something really simple that I’m doing wrong, but since there’s literally no documentation that I can find, all I have to go on is guessing, and so far I’ve had no luck with that.

I’m assuming that once I can see what’s available to query, I’ll be able to figure out how to query it. Can anybody point me in the right direction?

Thanks.

Hi!

To use your token in Altair, hover over the little gear icon in the upper left (to the left of the POST dropdown) and click on Headers. You’ll need “content-type” and “application/json” in the first row, and you’ll need “Authorization” and “Bearer YOUR_TOKEN_HERE” in the second row, where your_token_here is obviously your access token.

I’m new to this, too. Using GraphQL has definitely been a journey so far. :slight_smile: I agree that documentation is hard to find, as it seems that each place that offers a GraphQL API does it in a slightly different way. Documentation for one API winds up being completely unhelpful for another place. There’s some basic documentation at https://developer.shiphero.com/, but as you probably already know, it’s not specific to any clients like Altair or Playground or whatever.

1 Like

Thanks for the reply. I’m still having trouble though. Here’s the query I’m trying to run:

And here are my headers:

image

The results returned don’t seem to answer the query I asked.

You’re right. Yours is still off. It should look like this:

Your query is exactly the same as mine, and your URL looks correct. My guess is that there’s something wrong with your token. The only thing I can think of is in your initial authorization request where you got the token, make sure you’re using the reeeeeeeeeealy long “access_token” and not the shorter “refresh_token”. If you are, maybe do another authorization request to get a new access_token. (how you got your token the first time) They do expire every few weeks.

Also, one thing I forgot to mention is that the Docs button will only work once you’ve successfully gotten logged in with your token. If you get to the point to where you can run the quota query, then click the “reload docs” button (the round arrow to the left of “Docs”) and then open the Docs pane and you’ll see the documentation there. The documentation is about what queries/tables/fields are available, but it’s not “how to” sort of documentation, just to be clear. See the right pane in my screenshot for what I mean.

1 Like

Hi again,

I’m already using the reeeeeeeeeeeally long access token. This is the result of my request to get the token. Obviously I have to blur out the token itself, but it should give you an idea of the length of the one I’m using.

What you said about the docs makes sense, so it seems my issue is just getting logged in with this token.

Hmmm. Then I’m not sure. It may be worth contacting ShipHero support directly about.

That’s what I tried originally, and they pointed me to this forum and the new API. I did send them another email about it this morning (prior to your original reply). As I’ve been typing this reply, they replied to that email and pointed me to the documentation link that you mentioned earlier, and suggested that I post here in the forum.

What I’m looking for is explicit instructions. Really, there should be something that says in no uncertain terms “To use the new API, the URL is . You need to use method Post 1.1, and you need to send headers content-type = application/json and . To pass a query, send it in raw data.” And if they’re suggesting using Altair and other sites for testing, they should be including screenshots of exactly how to set each of them up.

1 Like

Hi,

Just in case anyone else has the same issues I’ve had, I thought I’d post the solution. Apparently, the web interface for Altair has problems. ShipHero support suggested that I download the desktop version - I tried that, but the link to the Windows version on Altair’s website is broken. I did install the Chrome extension, which worked fine:

Thanks!

2 Likes

Oh wow, @jrtwynam ! It never even occurred to me to look for anything other than the desktop version of Altair. Thanks for coming back and letting us know about the chrome extension. I’m going to check that out myself.

Hi,

Due to other projects within my organization, my attention was pulled away from this for awhile. Now that we’re coming closer to the planned deprecation date of the previous API, I’m looking at converting our inventory sync process to use the GraphQL API. While looking through the community forum, I came across a mutation “inventory_sync”, but my understanding is that it had some problems. I’ve gotten my process to the point where I need to write some inventory updates back to ShipHero, but I haven’t been able to find any sample GraphQL queries to do that. Ideally, what I’d like to pass in is the ShipHero product ID, the warehouse (name, not ID) since we have two warehouses set up and I only want to update inventory in one of them, the inventory bin (because we sometimes reslot products), and the new on hand quantity. The examples I’ve found in the examples section show a mutation to create a product (cunningly called “product_create”), but I don’t see an example of one that just updates certain fields of the product.

Right now, my process basically works like this (with a few extra steps thrown in here and there for logging purposes that I didn’t bother listing here):

  1. Download all ShipHero inventory in one shot into a CSV file.
  2. Download all inventory from our host warehouse management system in one shot into a CSV file.
  3. Execute a Windows Powershell script to compare the two files, which spits out another CSV file containing products where either the inventory bin or quantity don’t match.
  4. TO DO: Loop through the resulting file from step 3, sending a GraphQL query to ShipHero for each product listed.

It’s step 4 that I’m having trouble with. I’ve already managed to get an authorization token, but I don’t know the GraphQL to update a sku. Any thoughts?

Thanks.

Hi @jrtwynam !

Sounds like Inventory Sync would be a perfect fit for it.
You can always go the other way and change one by one, do you have a Dynamic Slotting account?

I may look at Inventory Sync later, but since I have everything working aside from the actual GraphQL that updates a single sku, I’d like to continue with that method for now. Plus, doing it that way allows me to include more logging and notification in the job if I should need it.