All Collections
Working With Data Events or Calculation fields
Data Events
Making a request to the Query API from your data events scripts
Making a request to the Query API from your data events scripts
Vince Lauffer avatar
Written by Vince Lauffer
Updated over a week ago

You can use the REQUEST function to make a GET or POST request to the Query API from your data events script.

Here is an example of a data events script function you could call in order to make a GET request to the Query API:

const getTableSize = () => {
var query = `SELECT COUNT(*) FROM "My App";`
var url = 'https://api.fulcrumapp.com/api/v2/query?format=json&q=' + encodeURIComponent(query);

var options = {
url: url,
method: "GET",
headers: {
'x-apitoken': apiToken,
'Content-Type': 'application/json',
'Accept': 'application/json'
},
};
REQUEST(options, function(err, res, body) {
if(err){
ALERT("Error with request. See console for more information.");
console.log(err);
}else{
ALERT("Request successful");
var res = JSON.parse(body);
console.log(res);
}
});
}
Did this answer your question?