Where can I find information on the fields I want to query on. Basically I am trying to extract data from inventory report (https://app.shiphero.com/reports/inventory) into csv/excel file. I thought I can start with warehouse in query and then get all products in the warehouse and then look for on hand quantity. But apparently , warehouse field doesn’t exist (Cannot query field “warehouse” on type “Query”). So where can I find information on field name and relationship?
Shifali,
In order to browse the documentation you will need to use one of the suggested clients
- Playground
- Altair
You should include the Authorization header with the jwt token you got from the token endpoint, otherwise you will get an error because there request are not authenticated.
Once the url is verified (you will a green pop with the confirmation) you will be able to browse de docs, which are usually located at the right side of the screen in both playgroun and altair.
In there you will be able to see all the available queries and mutations, along with their inputs and outputs.
Hi Shifali! thanks for contributing!
Adding some links:
They are both really good, but Altair will let you save a collection, which I found to be really helpful.
Let us know if theres anything else we can assist you with.
Thanks!
Thank you for your response. Much appreciate your help.
Not sure what I am doing wrong…I tried using Altair Web version, I added my JWT token under header with header key as Authorization and tried to send the request. It just shows me loading and doesn’t send any error message or response back. Also, nor loading the docs as well.
By the way, I wasn’t able to install the windows version as it is blocked by administrator policies.
Thanks,
Shifali
That information is sadly not available through the documented APIs.
Despite this fact, this is fairly straightforward to accomplish using another route. I regularly gather a lot of “reports”-type information for several of my clients using this method.
Simply take your ShipHero username and password (or create a user account designated for this purpose), then make a login request to app.shiphero.com/account/login/do_login
(the URL that app.shiphero.com/account/login
sends the login form to) and save the resulting Set-Cookie
results.
Use those cookies to load data from the endpoints that the ShipHero front-end uses to build the reports pages. Conveniently, at least if you’re using Node, the information is already in JSON.
In your case, you’d want to mimic the FE’s POST to:
app.shiphero.com/reports/inventory/getInventory
If you’re talking GraphQL (which it sounds like based on @seba’s response), GraphQL actually has some introspection features and the following article is a good intro to them:
shifali,
Could you share a screenshot of your headers?
When adding an Authorization header the value should be:
Bearer YOURTOKEN
Thanks!
Hi Shifali,
Just FYI, on that particular report, there are “CSV” and “Export all rows” buttons at the upper-right of the table that you can use to export as well. “CSV” will export only what is currently shown, but “Export all rows” will export everything on all pages to a CSV.
Yes we are aware of that, however, we would like to automate it via code to retrieve information without manual intervention. We have processes that runs to capture inventory for other banners and we would like to include this feed into our data.
Yes I did added Header Authorization and key as Bearer MYTOKEN (based on your screenshot above). I have attached mine too.
Thank you for your response.
So that I am clear and change my direction, the inventory information , data under app.shiphero.com/reports/inventory/getInventory , is not available with GraphQL? Please advise.
-Shifali
@shifali That is not currently availabel on the public api, but you can probably achieve the same by querying for warehouse products and applying any desired calculation,
Thank you @seba. Can you also please advise on why my Altair connection is hanging on loading only? I have attached the screen shots I my previous reply. It is difficult to proceed without knowing the fields available to query.
-Shifali
@shifali Not sure what might be wrong with Altair. We do have other customers using it with no problem at all. Did you try Playground?
You can always issue a special query to fetch the schema from the server (the one that altair and all the other IDEs do) but you will have to manually recreate the schema from that response.
Something like:
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}
fragment FullType on __Type {
kind
name
description
fields(includeDeprecated: true) {
name
description
args {
...InputValue
}
type {
...TypeRef
}
isDeprecated
deprecationReason
}
inputFields {
...InputValue
}
interfaces {
...TypeRef
}
enumValues(includeDeprecated: true) {
name
description
isDeprecated
deprecationReason
}
possibleTypes {
...TypeRef
}
}
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
defaultValue
}
fragment TypeRef on __Type {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
ofType {
kind
name
}
}
}
}
}
}
}
}
Hey,
I have the same problem, when I send it via AltAir, using my authorization token. It just says loading and nothing else appears
When Using GraphQL playground:
{
“Authorization”: "Bearer "
}
Bearer Token replaces
hey @harpolds @shifali here’s a video showing the GraphQL Playground in action.
We’re working on documentation and better guides - should be up in a few days.
Thank you for your response.
I was able to get the information using the Playground and got the data I was looking for as well.
Thanks,
Shifali
Hi,
Just wanted to check, if there is any limit on a number of records I can get by using GrapgQL. As I mentioned earlier, I am trying to get on_hand quantity from inventory report (basically, product by whse and on-hand inventory of a product in each warehouse). I got the information using GrpahQL and confirmed data matches with the front end. However, now when I ran the query without filters, it only returned me 300 records. Please let me know if I am missing something.
Your time and support are much appreciated.
Regards,
Shifali
I think the only limit is the number of “credits”, which refreshes every hour. Also, there’s a limit of the number of records returned in a single response, which requires the use of cursors to move back and forth through the “pages”. I think the limit is 100, so if you’re getting 300 back, then you may already know that one.