Hi, I had answered this on Slack too, but I thought I'd copy my answer here as it may be easier to find (for others in the future).
I'd recommend checking the DSpace logs to see if you can find more information about the 400 error. See our troubleshooting guide sections on finding errors in the REST API logs or using debug mode: https://wiki.lyrasis.org/display/DSPACE/Troubleshoot+an+error#Troubleshootanerror-DSpace7.x(orabove) If you can find an error message, it will tell you exactly why your code is failing. If you cannot understand the error, then you could share it here and other on this list may be able to help clarify it. You also could compare your request to the requests sent by the User Interface when creating / updating a workspace item. You can do this by watching the requests the UI sends in your browser. See this section of the docs for how to watch those UI requests: https://wiki.lyrasis.org/display/DSDOC8x/REST+API#RESTAPI-FindingwhichRESTAPIEndpointtouse Tim On Thursday, April 10, 2025 at 4:48:08 AM UTC-5 [email protected] wrote: > I have a previous message for an error 400. It's still not solved. > Now I tried copying the code that appears in the demo service for DSpace 8 > and i still got a status error 400. > This is the code: > const body1 = JSON.stringify({ > id: id, > type: "workspaceitem", > lastModified: "2025-04-10T09:33:23.893+00:00", > sections: { > collection: coleccio.uuid, > license: { > url: null, > acceptanceDate: null, > granted: false, > }, > upload: { > primary: null, > files: [], > }, > traditionalpagetwo: { > "dc.description.abstract": [ > { > value: > "DSpace 7.0 was released on Aug 2, 2021. Give it a try, or > better yet, try the latest 7.x release out there!", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > }, > traditionalpageone: { > "dc.publisher": [ > { > value: "DSpace software", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > "dc.contributor.author": [ > { > value: "DSpace Committers", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > "dc.type": [ > { > value: "Software", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > "dc.title": [ > { > value: "DSpace 7 is pretty amazing", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > "dc.date.issued": [ > { > value: "2021-11-02", > language: null, > authority: null, > confidence: -1, > place: 0, > }, > ], > }, > }, > }); > > const formUrl = ` > https://api-new-bcnroc.metricsalad.com/api/submission/workspaceitems/${id} > `; > 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); > Do you have any idea why it fails? > -- All messages to this mailing list should adhere to the Code of Conduct: https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx --- You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/dspace-tech/ff4a536f-8eb9-461a-b9e0-e3f4aec207cfn%40googlegroups.com.
