Public
Edited
Nov 18, 2021
Comments locked
3 stars
Insert cell
Insert cell
Insert cell
d3 = require("d3@7")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
app_target = (function(app_id, user_id) {
const target_url = 'https://realm.mongodb.com/api/client/v2.0/app/' + app_id + '/location?key=' + user_id;
const target_token = d3.json(target_url, {
headers: {
"Content-Type": "application/json"
},
async: false
});
return target_token;
})(app_id, user_id);
Insert cell
Insert cell
token = (function(app_id, api_key, app_target) {
var token_url = app_target.hostname + '/api/client/v2.0/app/' + app_id + '/auth/providers/api-key/login';
var token = d3.json(token_url, {
method: 'POST',
headers: {
'Content-Type': "application/json",
},
body: '{"key": "' + api_key + '"}'
});
return token;
})(app_id, api_key, app_target);
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.json(gql_url, {
'method': 'POST',
body: '{"query": "query { normalSample { x, pdf } }"}',
headers: {
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json"
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more