i will integrate in laravel 5.6 ship hero Every time every day API Key chnage?
Hi @bhavesh
Welcome to our community!
Are you referring to the token expiration? Getting Started â Developer Resources | ShipHero
Thanks in advance!
Tom
i read this document, please guide me on how to implement this API key for web development(PHP)?
Hi @bhavesh!
Iâm not familiarized with PHP I apologize for that.
I did found this article on how to Post JSON data with PHP
And in case it helps we had another user working with PHP that posted on this thread
Thanks again!
Tom
CURLOPT_USERPWD => base64_encode($username.":".$password),
â{ âusernameâ: âYOUR EMAILâ,
âpasswordâ: âYOUR PASSWORDâ
}â
which username and password should i required?
when i run this curl with url i got Response âusername is requiredâ
any Suggestion?
Hi @bhavesh!
You should use the same that when login on https://app.shiphero.com/dashboard
Let me know if that doesnât work for you,
Thanks again!
Tom
Yes i am using that but not working.
You could test with a test endpoint, something like:
To verify what is being sent and if itâs as expected
$body = âmutation {
order_create(
data: {
order_number: â11223344â
shop_name: âExampleShopâ
fulfillment_status: âpendingâ
order_date: â2019-07-29â
total_tax: â29.00â
subtotal: â150.00â
total_discounts: â20.00â
total_price: â159.00â
shipping_lines: {
title: âUPSâ
price: â0.00â
carrier: âUPSâ
method: âGroundâ
}
shipping_address: {
first_name: âJohnâ
last_name: âJohnsonâ
company: âThe Johnson Coâ
address1: â2543 Duck St.â
address2: âApt. 2â
city: âOklahomaâ
state: âOklahomaâ
state_code: âOKâ
zip: â73008â
country: âUSâ
country_code: âUSâ
email: âjohnjohnsonco@johnsonco.comâ
phone: â5555555555â
}
billing_address: {
first_name: âJohnâ
last_name: âJohnsonâ
company: âThe Johnson Coâ
address1: â2543 Duck St.â
address2: âApt. 2â
city: âOklahomaâ
state: âOKâ
state_code: âOKâ
zip: â73008â
country: âUSâ
country_code: âUSâ
email: âjohnjohnsonco@johnsonco.comâ
phone: â5555555555â
}
line_items: {
sku: âtestSKU12345â
partner_line_item_id: â282960815â
quantity: 2
price: â150.00â
product_name: âExample Productâ
fulfillment_status: âpendingâ
quantity_pending_fulfillment: 2
warehouse_id: âV2FyZWhvdYNlOjgwNzU=â
}
required_ship_date: â2019-08-29â
}
)
}â;
$username = 'xxx@lessgistics.com';
$password = 'xxx456';
//$credentials = base64_encode("$username:$password");
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL=> "https://public-api.shiphero.com/graphql",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
//CURLOPT_USERNAME => "sutharbhavesh1111@gmail.com", //"minipokemart@lessgistics.com", //
CURLOPT_POSTFIELDS => $body, // json_encode($order_to_ship), Created same as previous snippet
CURLOPT_USERPWD => base64_encode($username.":".$password), //"xxx@lessgistics.com:xxx456",
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
'Cache-Control: no-cache',
'Username: sutharbhavesh1111@gmail.com',
'refresh_token: U30pkJp5imhPDpFua92V-8LmMdNpySrNZQcuBOYPzw5kM',
//'Authorization: Basic {$credentials}',
'access_token:a8866579e12304937b5b9b11811f940efa80d83d',
'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJUQXlOVU13T0Rrd09ETXhSVVZDUXpBNU5rSkVOVVUxUmtNeU1URTRNMEkzTWpnd05ERkdNdyJ9.eyJodHRwOi8vc2hpcGhlcm8tcHVibGljLWFwaS9hcHAiOnsibmFtZSI6IlNoaXBoZXJvIFB1YmxpYyBBUEkgR2F0ZXdheSIsImlkIjoibXRjYndxSTJyNjEzRGNPTjNEYlVhSExxUXpRNGRraG4iLCJkYXRhIjp7fX0sImh0dHA6Ly9zaGlwaGVyby1wdWJsaWMtYXBpL3VzZXJpbmZvIjp7Im5hbWUiOiJzdXRoYXJiaGF2ZXNoMTExMUBnbWFpbC5jb20iLCJuaWNrbmFtZSI6InN1dGhhcmJoYXZlc2gxMTExIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20vYXZhdGFyL2EzODMzYTE4ZmVmNWMzMDFmYzEyOTE0MGRmODIyMTd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7ku9F7CaevuBQdBQvAQR5UxbzgQpzr6nAOwGCCjBFuY4XPbMa1WOWxINNlUQ'
],
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 0,
]);
$response = curl_exec($ch);
//echo "<pre>";
//print_r($response);
var_dump($response);
exit;
string(71) "{âmessageâ: âUnexpected error. Please contact a system administrator.â}"
I get in this error now please any one can help me i am stuck in this code since last one week
Hi @bhavesh!
Could you share the request_id
returned for that mutation?
If you try using an IDE such as Altair, does it work with that same payload?
Thanks in advance!
Tom
Bearer code is not working i think all perfect stepby step follow but not working
âerrorâ: âFailed to fetch schema. Please check your connectionâ
Try adding the account query, something like this:
query {
account {
request_id
complexity
data {
id
legacy_id
}
}
}
And seeing if it returns something
same error display
âerrorâ: âFailed to fetch. Please check your connectionâ
Connection error
How to get Warehouse id from query?
Hello!
This is the query you would use to get the warehouse id:
query{
account{
data{
warehouses{
id
}
}
}
}
hello @tomasw @Theresa
Thank You for replay i have tested and there is working on âAltair GraphQLClientâ Than after run this code on my file give me this Respons.
âmessageâ: âUnexpected error. Please contact a system administrator.â}
Thanks in advance!
Bhavesh
Hi @bhavesh!
If you send both to Request Bin (Altair and your code) can you spot any difference between both?
Thanks again!
Tom
Hello @tomasw
No changes difference between both code
Thanks again!
Bhavesh
Thanks for confirming that @bhavesh!
Are you on a fulfillment account?
If that is the case it wonât work because those accounts donât have warehouses, but you could try getting your warehouse ID from the following Query:
query{
account{
request_id
complexity
data{
id
legacy_id
my_warehouse {
id
}
}
}
}
Is there any chance you could send us a request_id
for when you try this on Altair and sends you the correct response back?
That way we can get your account details and investigate further.
Thanks again!
Tom
Thanks for guide to me @tomasw
order is working fine but i not find out this same question.
- How to get tracking number from order because i send a email in put this tracking number.
- Order date i will put but he automatically add yesterday date.
please give me suggestion
Thanks again!
Bhavesh