Reputation: 21
Following errors has occured:
Fatal error: Uncaught exception 'ShopifyApiException' with message 'Bad Request' in D:\xampp\htdocs\cutoutphoto\lib\shopify.php:87 Stack trace: #0 D:\xampp\htdocs\cutoutphoto\lib\shopify.php(203): ShopifyClient->call('POST', '/admin/products...', '{"image":{"posi...') #1 D:\xampp\htdocs\cutoutphoto\requests.php(217): ShopifyClient->update_image('134789371', 'D:\xampp\tmp\ph...', 'tango-featured....') #2 {main} thrown in D:\xampp\htdocs\cutoutphoto\lib\shopify.php on line 87
Upvotes: 0
Views: 772
Reputation: 2039
Wrap the method or the lines where you have ShopifyClient->update_image() in a try...catch block
Eg:
try {
ShopifyClient->update_image('134789371', '/location/of/the/file', ...);
} catch(Exception $e){
//do something with the Exception
echo $e->getMessage();
}
I think you might be getting the Bad Request error because you are not passing all the parameters to the API or sending those params in the incorrect format. Also, check if you are using the correct authentication credentials for the API.
Also, its helpful for us to answer questions if you do provide some more information like what is your code trying to do, post that block of code here, rather than just the stack trace. But I see this is your first post on Stack Overflow so don't mind :)
Upvotes: 3