Skip to content

Instantly share code, notes, and snippets.

@sharpred
Last active May 19, 2017 09:56
Show Gist options
  • Save sharpred/f3f50ac49543a7c658e7531f9153c8c8 to your computer and use it in GitHub Desktop.
Save sharpred/f3f50ac49543a7c658e7531f9153c8c8 to your computer and use it in GitHub Desktop.
checkr webtask
/*
* 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