我在 ETSY 上使用更新库存 API 时收到错误响应“所有产品需要提供”

问题描述

下面是我正在使用的代码

$offering_price_data = array(
                                    'amount'        =>      1000,);
                $offering_data = array(
                                    'offering_id'   =>  $offering_data['offering_id'],'price'         =>  $offering_price_data,'quantity'      =>  100,'is_enabled'    =>  $offering_data['is_enabled'],'is_deleted'    =>  $offering_data['is_deleted']
                                );
                $products_data = array(
                    'product_id'            =>  $product_data['product_id'],'sku'                   =>  $listData['SKU'],'property_values'       =>  [],'offerings'             =>  $offering_data
                );

                $product_up_data = array(
                    'listing_id'    =>  $listData['listing_id'],'products'      =>  json_encode($products_data)
                );
                //var_dump($product_up_data);exit;
                $userToken = UserUtils::getUserToken();
                $consumerKey = config::APP_CLIENT_ID;
                $consumerSecret = config::APP_CLIENT_SECRET;
                $token = $userToken[0]['permanent_token'];
                $secret = $userToken[0]['permanent_secret'];
                $invReqUrl = 'https://openapi.etsy.com/v2/listings/'.$listData['listing_id'].'/inventory';

                $oauth = new OAuth($consumerKey,$consumerSecret,'HMAC-SHA1',1);
                $oauth->setToken($token,$secret);

                $Updata = $oauth->fetch($invReqUrl,$product_up_data,"PUT");
                $respUpdateListing = $oauth->getLastResponse();
                $UpdateResponse = json_decode($respUpdateListing,true);

作为回应,我得到 “无效的身份验证/错误请求(得到 400,预期的 HTTP/1.1 20X 或重定向” 最后回复“所有产品都需要产品”

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)