Last active
May 28, 2016 00:54
-
-
Save fadhlirahim/cdda03125351299f0784073bc79f362c to your computer and use it in GitHub Desktop.
Fetch all error jobs from bitcodin api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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