Skip to content

Instantly share code, notes, and snippets.

@fadhlirahim
Last active May 28, 2016 00:54
Show Gist options
  • Save fadhlirahim/cdda03125351299f0784073bc79f362c to your computer and use it in GitHub Desktop.
Save fadhlirahim/cdda03125351299f0784073bc79f362c to your computer and use it in GitHub Desktop.
Fetch all error jobs from bitcodin api
var fs = require('fs');
var apiKey = "api-key";
var bitcodin = require('bitcodin')(apiKey);
var promise = bitcodin.job.getDetails(1);
promise.then(function (data) {
console.log(data);
});
}
});
var fs = require('fs');
var apiKey = "api-key";
var bitcodin = require('bitcodin')(apiKey);
var promise = bitcodin.job.list(1, 'error');
promise.then(function (data) {
for(var i=0; i < data.jobs.length; i++){
console.log(data.jobs[i].jobId);
fs.appendFile('log.txt', data.jobs[i].jobId + "\n", function (err) {
if (err) throw err;
// console.log('The "data to append" was appended to file!');
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment