我有错误,如坏的请求,而在shopify使用api添加产品


i have error like bad request while add product in shopify using api

出现以下错误:

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

包装的方法或行,你有ShopifyClient->update_image()在一个尝试…catch块

,

try {
  ShopifyClient->update_image('134789371', '/location/of/the/file', ...); 
} catch(Exception $e){
  //do something with the Exception
  echo $e->getMessage();
}

我认为你可能会得到错误的请求错误,因为你没有传递所有的参数到API或以不正确的格式发送这些参数。另外,检查您是否为API使用了正确的身份验证凭据。

此外,如果您确实提供了一些信息,如您的代码试图做什么,在这里发布代码块,而不仅仅是堆栈跟踪,这对我们回答问题很有帮助。但我看到这是你在Stack Overflow上的第一篇文章,所以不要介意:)