Public
Edited
Jul 20, 2023
1 fork
Insert cell
Insert cell
Insert cell
requestBody = ({
sampleTypeId: 1,
nuclideId: "1",
samplingDepthFrom: 0.5,
samplingDepthTo: 0.8,
samplingDateFrom: "2000-01-01",
samplingDateTo: "2015-01-01"
})
Insert cell
function objectToQueryString(obj) {
const keyValuePairs = [];

for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
const encodedKey = encodeURIComponent(key);
const encodedValue = encodeURIComponent(obj[key]);
keyValuePairs.push(`${encodedKey}=${encodedValue}`);
}
}

return keyValuePairs.join('&');
}
Insert cell
fetch(
`https://maris-uat.iaea.org/api/Search/getMeasurementData?${objectToQueryString(
requestBody
)}`
)
.then((r) => r.json())
.then((data) => {
console.log(data);
})
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