-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetQueryResults.js
50 lines (44 loc) · 886 Bytes
/
getQueryResults.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
async function _getQueryResultsWeb(req,res) {
if (!req.body) {
res.send({"ERROR":"Invalid Body"})
return;
}
if (!req.body.queryId) {
res.send({"ERROR":"No queryId in body"})
return;
}
var axios = require('axios');
var data = JSON.stringify({
"jsonrpc": "2.0",
"method": "getQueryRunResults",
"params": [
{
"queryRunId": req.body.queryId,
"format": "json",
"page": {
"number": 1,
"size": 1
}
}
],
"id": 1
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api-v2.flipsidecrypto.xyz/json-rpc',
headers: {
'Content-Type': 'application/json',
'x-api-key': process.env.FLIPSIDE_API_KEY
},
data : data
};
axios(config)
.then(function (response) {
res.send(response.data)
})
.catch(function (error) {
console.log(error);
});
}
exports.getQueryResultsWeb = _getQueryResultsWeb