relationship between publication and author

49 views
Skip to first unread message

Alex B

unread,
Mar 10, 2025, 5:08:24 AM3/10/25
to DSpace Technical Support
Dear colleagues, help me solve the problem:
create the relationship isAuthorOfPublication between the publication and the author by REST API.
I did:
receive Bearer token - 
curl -v -X POST  --data "user=<root-email>&password=<password>" "https://<api server uri>/server/api/authn/login" -H "X-XSRF-TOKEN: {csrf-token}" --cookie "DSPACE-XSRF-COOKIE={csrf-token}"

run curl - 
curl -i -X POST 'https://<api server uri>/server/api/core/relationships?relationshipType=1' -H 'X-XSRF-TOKEN: {csrf-token}' --cookie 'DSPACE-XSRF-COOKIE={srf-token}' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ...' -H 'Content-Type:text/uri-list' --data 'https://<api server uri>/server/api/core/items/<author dspace uuid>\nhttps://<api server uri>/server/api/core/items/<publication dspace uuid>'

receive - error 403
HTTP/1.1 403
Date: Mon, 10 Mar 2025 05:56:27 GMT
Server: Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k
Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
DSPACE-XSRF-TOKEN: 1c2814d0-c97a-4f1d-9a65-2b49a83e1028
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: DENY
Content-Type: application/json;charset=UTF-8
Set-Cookie: DSPACE-XSRF-COOKIE=; Path=/server; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=None
Set-Cookie: DSPACE-XSRF-COOKIE=1c2814d0-c97a-4f1d-9a65-2b49a83e1028; Path=/server; Secure; HttpOnly; SameSite=None
Access-Control-Allow-Origin: https://<api server uri>
Access-Control-Allow-Methods: GET, POST, OPTIONS, PATCH, DELETE
Access-Control-Allow-Headers: Content-Type, Authorization, x-referrer, x-correlation-id, x-xsrf-token
Access-Control-Allow-Credentials: true
Transfer-Encoding: chunked

{"timestamp":"2025-03-10T05:56:27.687+00:00","status":403,"error":"Forbidden","message":"Access is denied. Invalid CSRF token.","path":"/server/api/core/relationships"}

Help me please.

Best regards,
Alex

Alex B

unread,
Mar 31, 2025, 8:42:59 AM3/31/25
to DSpace Technical Support
problem solved

понедельник, 10 марта 2025 г. в 12:08:24 UTC+3, Alex B:
Reply all
Reply to author
Forward
0 new messages