【发布时间】:2016-07-02 19:02:26
【问题描述】:
处理我的第一个 WordPress 小部件 API 调用时,我很困惑为什么当我尝试定位商店时请求没有返回任何内容。当我阅读文档时,我看到了findAllShops 并尝试了:
$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;
和
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?method=GET&api_key=:' . $apikey;
但我的 JSON 文件返回空白。引用标签etsy 我被引导到Getting all listing images from an Etsy shop 但是当我尝试使用时:
$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';
$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;
我的 JSON 文件返回空白。在研究了 Etsy 的 API 文档后,它确实说 getShop 方法应该以 id 或 name 的形式获取 shop_id 的参数类型数组。如何让 API 通过 name 而不是 id 返回商店的 JSON?
编辑:
在 cmets 之后,我的印象是我可以从以下位置提取店铺名称:
当我访问 array(shop_id_or_name) 时,我得到:
商店的数字 ID 或登录名。 (注:店铺ID不是 可与用户 ID 互换。)
我可能会误解它,但基于此,我认为我能够获得商店的名称。
我也在Apigee's etsy console 上尝试过这些,当我选择findAllShops 方法时,我得到了请求 URL:
https://openapi.etsy.com/v2/private/shops
我拿了这个并添加了我的令牌。仍然返回一个空白 JSON 文件。
【问题讨论】:
-
你收到返回标题了吗?速率限制有效吗?
-
您无法让 getShop 使用该名称,因为 API 似乎不是以这种方式构建的。您可以尝试使用上面的函数 getAllShops 来查找 shop_id。
-
@aynber 说我应该可以得到店名here,不是吗??
-
@Darth_Vader 我错过了那部分,所以我更正了。
-
@Kkinsey 我从apigee's console 中提取了所有程序,并在我的 PHP 文件中添加了我的令牌。
标签: etsy php json wordpress api etsy