georgicodes / etsy-js

etsy-js is an asynchronous nodeJS wrapper for the etsy v2 api.
https://www.npmjs.org/package/etsy-js
35 stars 25 forks source link

API key not being used #2

Closed rarkins closed 9 years ago

rarkins commented 9 years ago

I tried running the very first example in the README and it failed.

index.js:

var etsyjs = require('etsy-js');
var client = etsyjs.client('IPUTMYAPIKEYHERE');

// direct API calls (GET / PUT / POST / DELETE)
client.get('/users/sparkleprincess', {}, function (err, status, body, headers) {
  console.log(body); //json object
});

Running it:

$ node index.js
'==> Client get request with params [object Object]'
'==> Perform unauthenticated GET request'
'API URL is https://openapi.etsy.com/v2/users/sparkleprincess '
'Error parsing response: API request missing api_key or valid OAuth parameters'
undefined
$

I verified that if I take the same URL and add ?api_key=....... to it in a browser, it works fine. So seems that client is not including the api_key header?

rarkins commented 9 years ago

Never mind, seems it's a documentation error. It should read:

var client = etsyjs.client({
  key: 'key'
});