-
Notifications
You must be signed in to change notification settings - Fork 3
/
example-connection.html
40 lines (38 loc) · 1.82 KB
/
example-connection.html
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
<html>
<head>
<script src='../dist/bouquet.js'></script>
</head>
<body>
<p>Simple 2-step example running an analysis from a query URI and using bouquet.js</p>
analysis :
<pre id='root'> </pre>
<script>
var bouquet = new Bouquet({
url : '//demo.openbouquet.io/release/v4.2',
clientId : 'api-key-client',
apiKey : 'eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJhcGkta2V5LWNsaWVudCIsInN1YiI6IjU4YWM1Y2FiMTVhYmNjMTJiYjUwYTU0MCIsInVzZXJFbWFpbCI6ImRlbW9AbG9jYWxob3N0LmNvbSIsImN1c3RvbWVySWQiOiI1OGFjNTNjMDE1YWJjYzEyYmI1MGE0NWIiLCJqdGkiOiJnTmF3dHdiZzRaYXRtQ1JXVVRQYnFnIiwiZXhwIjo0NjQxNTM0NTE5LCJpYXQiOjE0ODc5MzQ1MTksIm5iZiI6MTQ4NzkzNDM5OX0.g5f1DHxESj9PvC5meP8UKXmcZzbGZIiW-qwZ7mNAZWTlMlaAdIn1EBOZzB9oAwHzQxS0qez0iRDac874YCmnHrwYI8kgVoJQvbbJedKIJjfP_V_ZPvMiAfsX0wqeCmqG4_uXZoAh_sumvyDkKGfzutAfpR3DCVkWTqfYZ-iornkyYwH89Yqe_yBNQPO4pXpf3Dg68BlruZqc-tiow3ytynyxuEYEOPYIuyRL-fLpjNstRGa_gXIQYBx9v1yVGlZsQFVviJ5PMbCgIduM36g5leA_IXprw46KxjH_snbnEvAHypZCwhNaJJxlLGBEWTMnFKqytR68CGURskRM2D0VPQ'
});
document.getElementById('root').innerHTML = "Connecting...";
// step 1
bouquet.request("/rs/user")
.then(function(user) {
document.getElementById('root').innerHTML = "Connected";
update();
})
.catch(function(err) {
document.getElementById('root').innerHTML = "Failed to connect: "+err;
});
// step 2
function update() {
document.getElementById('root').innerHTML = "Running...";
bouquet.request("/analytics/@'5899bc6715abcc6bed69d766'.@bookmark:'58a5dc6b45d778b2bdb231c9'/query?envelope=ALL&data=TABLE")
.then(function(res) {
document.getElementById('root').innerHTML = JSON.stringify(res.result, undefined, 4);
})
.catch(function(err) {
document.getElementById('root').innerHTML = err;
});
}
</script>
</body>
</html>