0

What is the Esty api call for the standard search on etsy.com?
I would like to get the number of results when searching for "winter giraffe" on etsy.com, which is 472.

So far, I have:

String api_key = ...;
String terms = "winter+giraffe";

try{

        String output = getHTML("https://openapi.etsy.com/v2/listings/active.js?keywords="+
                       terms+"&limit=12&includes=Images:1&api_key="+api_key);
        String input = output;
        int index = input.indexOf("listing_id");
        int count = 0;
        while (index != -1) {
                count++;
                input = input.substring(index + 1);
                index = input.indexOf("listing_id");
        }
        System.out.println("\nNo of listings is : " + count);


       }
       catch(Exception e){System.out.println("Something went wrong.");}

The problem is that this gives me

"No of listings is :24"

Also, in the output string, it says :

"count":50100. So that is also not it..

Anil_M
  • 10,893
  • 6
  • 47
  • 74

1 Answers1

0

It isn't obvious to me what the keywords parameter value is checked against. You might have better luck using tags instead of keywords:

String output = getHTML("https://openapi.etsy.com/v2/listings/active.js?tags="+terms+"&limit=12&includes=Images:1&api_key="+api_key);

(I get 7 results with this query.)

Laurel
  • 5,965
  • 14
  • 31
  • 57