Etsy counter

Posted on
  • Hello,
    I'm trying to create a counter for Etsy platform which has its own API. I have already tried it via console ( with XMLHttpRequest()) and everything works fine. And have started working with ESP8266.
    Wifi connected, the request is sent, but I receive not the same answer as for example when putting the same URL in the browser.

    My function:

    function getPage() {
      require("http").get("https://openapi.etsy.com/v2/shops", function(res) {
       console.log("Response: ",res);
         res.on('data', function(data) { contents += data; });
         res.on('close', function(contents) { console.log(contents); });
      });
    }
    getPage();
    

    in console I see:

    =undefined
    Response:  httpCRs {
      "headers": {
        "Location": "https://openapi.etsy.com/v2/shops",
        "Server": "BigIP",
        "Content-Length": "0",
        "Accept-Ranges": "bytes",
        "Date": "Thu, 20 Jul 2017 03:06:32 GMT",
        "Via": "1.1 varnish",
        "Age": "0",
        "Connection": "close",
        "X-Served-By": "cache-yyz8330-YYZ",
        "X-Cache": "MISS",
        "X-Cache-Hits": "0",
        "X-Timer": "S1500519992.012622,VS0,VE37"
       },
      "httpVersion": "1.1",
      "statusCode": "302",
      "statusMessage": "Found"
     }
    false
    

    But if I put the same request in browser "https://openapi.etsy.com/v2/shops" I at least see "API request missing api_key or valid OAuth parameters" (just don't want to show my ApiKey).

    As for other links "http://www.pur3.co.uk/hello.txt" or "http://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=b1b15e88fa797225412429c1c50c122a1" everything is ok.

    So in result I'm see 'the wall' before next steps.

    Could anyone help to solve it?

    Thanks

  • Looks like you got this sorted? http://forum.espruino.com/conversations/307898

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Etsy counter

Posted by Avatar for Hansi @Hansi

Actions