npm install yql-authA YQL helper with OAuth support for Node.js
npm install yql-auth --savejavascript
var yql = require('yql-auth');yql.query('select * from geo.concordance where namespace="iata" and text="sfo"').then(function (response) {
console.dir(response);
}).catch(function (error) {
console.error(error);
});
`$3
`javascript
var yql = require('yql-auth').options({
OAuth: {
ID: '[CLIENT_ID]',
Secret: '[CLIENT_SECRET]'
}
});yql.query('SELECT * FROM pm.finance.articles WHERE symbol="EURUSD"').then(function (response) {
console.dir(response);
}).catch(function (error) {
console.error(error);
});
`$3
`javascript
// Besides OAuth {ID: ID, Secret: Secret}, you can define the format of the response.
// It supports JSON and XML (in lowercase)
.options({
format: 'xml'
})
``