Dᴀʀ*_*ᴅᴇʀ 2 php api wordpress json etsy
在对 WordPress 小部件进行第一次 API 调用时,我很困惑为什么当我尝试定位商店时请求没有返回任何内容。当我阅读文档时,我看到findAllShops并尝试了:
$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;
Run Code Online (Sandbox Code Playgroud)
和
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?method=GET&api_key=:' . $apikey;
Run Code Online (Sandbox Code Playgroud)
但我的 JSON 文件返回空白。引用标签etsy我被引导到从 Etsy 商店获取所有列表图像,但是当我尝试使用时:
$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;
Run Code Online (Sandbox Code Playgroud)
我的 JSON 文件返回空白。在研究了 Etsy 的 API 文档后,它确实说该方法应该以or的形式getShop获取类型数组的参数。我怎样才能让 API 按它而不是按返回 JSON 为商店?shop_ididnamenameid
经过评论后,我的印象是我可以从以下位置提取商店名称:
当我访问时array(shop_id_or_name)我得到:
商店的数字 ID 或登录名。(注意:商店 ID 与用户 ID 不可互换。)
我可能会误解它,但基于此我认为我能够得到商店的名称。
我还在Apigee 的 etsy 控制台上尝试了这些,当我选择该方法时,findAllShops我收到了请求 URL:
https://openapi.etsy.com/v2/private/shops
Run Code Online (Sandbox Code Playgroud)
我拿了这个并添加了我的令牌。仍然返回一个空白的 JSON 文件。
:您的请求字符串除了之前的冒号 ( ) 之外都是正确的shop_id。
例如:
返回所有商店
https://openapi.etsy.com/v2/shops/?api_key=$apikey
按 ID 或名称返回特定商店
https://openapi.etsy.com/v2/shops/$shop_id_or_name?api_key=$apikey
返回特定商店的所有活跃列表
https://openapi.etsy.com/v2/shops/$shop_id_or_name/listings/active?api_key=$apikey
| 归档时间: |
|
| 查看次数: |
1873 次 |
| 最近记录: |