Here is the stream url : https://:[email protected]/api/v1/timeseries/models/urn:adsk.dtm:LudKiyWAQcCPqK2gQWxNfw/streams/AQAAAMTWX-rTaksXg95DuoCDE6UAAAAA
I've managed to send json data from Postman to the above URL without any authentication. I've try to send the same json data via Javascript. The error in the console is " Forbidden". I'm not sure if I need to provide any more credential when using the Javascript method. Below is my code :
"https://tandem.autodesk.com/api/v1/timeseries/models/urn:adsk.dtm:LudKiyWAQcCPqK2gQWxNfw/streams/AQAAAMTWX-rTaksXg95DuoCDE6UAAAAA";
const data = [
{
Temperature: 25, // Replace with your temperature value
// Replace with your value
},
];
// Send the POST request
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer :nYjvNhH3TKODSJuWL-0MTQ", // Your Bearer token
},
body: JSON.stringify(data),
})
.then((response) => {
// Check if the response is JSON
const contentType = response.headers.get("content-type");
if (contentType && contentType.indexOf("application/json") !== -1) {
return response.json();
} else {
return response.text();
}
})
.then((data) => {
console.log("Success:", data);
})
.catch((error) => {
console.error("Error:", error);
});
the ingestion URL uses basic authentication. Instead of using Bearer token simply use basic authentication, i.e.:
You can find complete example here.