I have been attempting to use the ESV bible API to create a drafts action that will pull in bible verses based on highlighted text. I have made this work using workflow but it would be nice to have it integrated and not have to leave the drafts app. That being said, I have tried and tried to get this code to work but nothing seems return a successful response. Every time I run the script I get a -1
response from the http.request.
Here is what I have for my code. I have striped everything down to the bear minimum at this point
var http = HTTP.create();
//I took my token out for obvious reasons.
var credential ="1234";
var response = http.request({
"method":"GET",
"url":"https://api.esv.org/v3/passage/text/",
"headers": {
"Authorization":"Token "+ credential
},
"data": {
"q":"john3:16"
}
});
if (response.success) {
var text = response.responseText;
var data = response.responseData;
}
else {
console.log(response.statusCode);
console.log(response.error);
}
I have tried other web services from drafts and had no issue. I also took all this data and ran it from an Ajax function from my browser which had no issue and I ran it through a couple API tools as well just to make sure the issue wasn’t server side.
Any help would be appreciated.
Thanks,
Nathan