const submissionResponse = await fetch(submissionUrl, {
method: "POST",
headers: {
Authorization: bearerToken ?? "",
Cookie: xsrfCookie,
"Content-Type": "application/json",
"X-XSRF-TOKEN": csrfToken ?? "",
},
});
//console.log(submissionResponse);
const data = await submissionResponse.json();
const id = data.id;
const body1 = JSON.stringify({
id: id,
type: "workspaceitem",
sections: {
traditionalpageone: {
"dc.title": titol,
"dc.date.issued": dataPub, "dc.type": tipusDocument,
},
},
});
const formResponse = await fetch(formUrl, {
method: "PATCH",
headers: {
Authorization: bearerToken ?? "",
Cookie: xsrfCookie,
"Content-Type": "application/json",
"X-XSRF-TOKEN": csrfToken ?? "",
},
body: body1,
});
console.log(formResponse);
The data I upload has the required format.