Created
March 14, 2017 17:31
-
-
Save alasarr/c027051f7baa7ea05b7cf6b40349bac8 to your computer and use it in GitHub Desktop.
CARTO batch API sample script
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 request = require("request"); | |
var api_key = "XXXX"; | |
var url = "https://{{account}}.carto.com/api/v2/sql/job"; | |
var options = { | |
method: "POST", | |
url: url, | |
qs: { | |
"api_key": api_key | |
}, | |
headers: { | |
"content-type": "application/json" | |
}, | |
body: { | |
query: "select 'heavy query' " | |
}, | |
json: true | |
}; | |
request(options, function (error, response, body) { | |
if (error) throw new Error(error); | |
console.log(url+'/'+body.job_id+'?api_key='+api_key); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment