Hey! I’m somewhat new to ShipHero’s API and we’re using a new tool with it. The issue is that I can’t for the life of me get the dates formatted correctly as JSON. I can make this query work without dates, etc but am hoping to get it working with dates. Ideally with variables as the dates so I can change them as needed easier. Any help would be greatly appreciated!
{
“query”: "query { shipments(date_from: “2022-07-01"date_to: “2022-07-03”) { request_id complexity data { edges { node { id order_id legacy_id profile order { order_number account_id fulfillment_status shop_name shipping_lines { title carrier method price } } shipping_labels { id legacy_id shipment_line_items(first: 10) { edges { node { line_item_id line_item { sku quantity } } } } account_id box_name status tracking_number order_number order_id order_account_id shipping_name carrier shipping_method cost profile created_date dimensions { weight height length width } address { city state country } } } } } }}”
}
I have to run the request as JSON with the tool we’re using and we’ve made plenty of other queries work, this is the one we’re stuck on.
Thanks!
Hey @barrettshepherd,
I’m going to look into this and get back to you with an update.
Thanks for your patience!
Best,
RayanP
Hey @barrettshepherd,
I noticed that you’re using a different type of quotation marks in your query.
Could you try replacing the date line with shipments(date_from: "2022-07-01", date_to: "2022-07-03")
instead?
For reference here’s what the full query would look like:
query {
shipments(date_from: "2022-07-01", date_to: "2022-07-03") {
request_id
complexity
data {
edges {
node {
id
order_id
legacy_id
profile
order {
order_number
account_id
fulfillment_status
shop_name
shipping_lines {
title
carrier
method
price
}
}
shipping_labels {
id
legacy_id
shipment_line_items(first: 10) {
edges {
node {
line_item_id
line_item {
sku
quantity
}
}
}
}
account_id
status
tracking_number
order_number
order_id
order_account_id
shipping_name
carrier
shipping_method
cost
profile
created_date
dimensions {
weight
height
length
width
}
address {
city
state
country
}
}
}
}
}
}
}
Please let me know if you have any questions or concerns!
Best,
RayanP
Hey,
I’ll try that. The query you posted isn’t JSON formatted, which is the issue I’m up against. Any tips on making it work in that format?
Hey @barrettshepherd,
I believe this should be in proper JSON format:
{"query": "query { shipments(date_from: \"2022-07-01\", date_to: \"2022-07-03\") { request_id complexity data { edges { node { id order_id legacy_id profile order { order_number account_id fulfillment_status shop_name shipping_lines { title carrier method price } } shipping_labels { id legacy_id shipment_line_items(first: 10) { edges { node { line_item_id line_item { sku quantity } } } } account_id box_name status tracking_number order_number order_id order_account_id shipping_name carrier shipping_method cost profile created_date dimensions { weight height length width } address { city state country } } } } } } }"}
As far as tips can go you’re aware of the quotation marks and that they need to be consistent. Also, the " \ " in the quotations are necessary so that the JSON parses them as text and not as start/end for a field.
Please let me know if you have any questions or concerns!
Best,
RayanP