Last active
May 19, 2017 09:56
-
-
Save sharpred/f3f50ac49543a7c658e7531f9153c8c8 to your computer and use it in GitHub Desktop.
checkr webtask
This file contains 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
/* | |
* set a webtask called checkrKey for your API key | |
*/ | |
module.exports = function (ctx, request, response) { | |
var request = require("request"); | |
var authKey = 'Basic ' + ctx.secrets.checkrKey; | |
var url = 'https://api.checkr.com/v1/reports/' + ctx.data.id; | |
var options = { | |
method: 'POST', | |
url: url, | |
headers: | |
{ | |
'content-type': 'application/x-www-form-urlencoded', | |
authorization: authKey | |
} | |
}; | |
request(options, function (error, httpResponse, body) { | |
if (error) throw new Error(error); | |
response.writeHead(200, { 'Content-Type': 'application/json ' }); | |
response.end(body); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment