DSpace 8 Creation of a submission workspaceitem -400 error

17 views
Skip to first unread message

Alfredo Alexander

unread,
Apr 8, 2025, 7:24:44 AM4/8/25
to DSpace Technical Support
Hi everyone.
I'm having an issue while creating a workspaceitem.
I'm following the api documentation and I'm getting a status 400 errror.
This is my code:
  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.
Can you please, give me some guidance?
Thanks for all your help

Reply all
Reply to author
Forward
0 new messages