2
votes

Working on my first API call for a WordPress widget I am confused why the request is returning nothing when I try to target a store. When I read the documentation I saw findAllShops and tried:

$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';

$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;

and

$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?method=GET&api_key=:' . $apikey;

but my JSON file returns blank. Referencing the tag I was led to Getting all listing images from an Etsy shop but when I tried to use:

$apikey = 'xxxxxxxxxx';
$apishop = 'FooBar';

$apiurl = 'https://openapi.etsy.com/v2/shops/:' . $apishop . '/listings/active?api_key=' . $apikey;

my JSON file returned blank. After researching Etsy's API documentation it does say that getShop method should get the parameters of shop_id with type array in the form of id or name. How can I get the API to return JSON for a shop by it's name and NOT by the id?

Edit:

After comments, I was under the impression I am able to pull shop name from:

enter image description here

and when I visit array(shop_id_or_name) I get:

Either a shop's numeric ID or login name. (Note: shop IDs are not interchangeable with user IDs.)

I could be misunderstanding it but based on that I thought I was able to get the shop's name.

I also tried these on Apigee's etsy console and when I select the method findAllShops I get the request URL:

https://openapi.etsy.com/v2/private/shops

and I took this and added my token. Still returns a blank JSON file.

1
Are you getting return headers? Rate limit in effect? - Kevin_Kinsey
You can't get getShop to use the name, since the API doesn't seem to be built that way. You can try to use the function above it, getAllShops, to find the shop_id. - aynber
@aynber says I should be able to get shop name here, no?? - DᴀʀᴛʜVᴀᴅᴇʀ
@Darth_Vader I missed that part, so I sit corrected. - aynber
@Kkinsey I pulled every procedure from apigee's console and just added my token in my PHP file. - DᴀʀᴛʜVᴀᴅᴇʀ

1 Answers

4
votes

Your request string is all correct, except the colon (:) before the shop_id.

For example:

Returns all shops

https://openapi.etsy.com/v2/shops/?api_key=$apikey

Return a specific shop by ID or name

https://openapi.etsy.com/v2/shops/$shop_id_or_name?api_key=$apikey

Return all active listings from a specific shop

https://openapi.etsy.com/v2/shops/$shop_id_or_name/listings/active?api_key=$apikey

All tested on Apigee's etsy console