I am developing a react app over DHIS2 and data online that is structured like:
indicators: [
{
name: "something",
attributeValues : [ {}],
anotherNode: "anything",
},
{},
{}, ...
]
I am trying to update the whole attributeValues Node. I'm using a fetch request, but getting
405 method not allowed
What do you suppose i'm doing wrong. This is the fetch post request i wrote.
let dataToSend = {
lastUpdated: currentTime,
created: currentTime,
value: newName,
attribute: {
id: indicatorID,
},
};
fetch(`https://www.namis.org/namis1/api/indicators/${id}/attributeValues`, {
body: JSON.stringify(dataToSend),
headers: {
Authorization: basicAuth,
"Content-type": "application/json",
},
method: "POST",
}).then((response) => response.json());
If the question happens to be a duplication, please direct me to the possible already existing solution.
Regards.