Dear colleagues, help solve this problem: When trying to create the relationship between a publication and an author via API, I get error 422. Both items exist and accessible. Example of implementation:
curl -i -v -X POST 'https://.../server/api/core/relationships?relationshipType=1' -H 'X-XSRF-TOKEN: {csrf-token}' --cookie 'DSPACE-XSRF-COOKIE={csrf-token}' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI1ODg4MzU2NC00ZmFmLTQxY2QtYmY1Ny1iNTJiOWY2M2FhYjIiLCJzZyI6W10sImF1dGhlbnRpY2F0aW9uTWV0aG9kIjoicGFzc3dvcmQiLCJleHAiOjE3NDM0MDg0NzV9.WcWjWZn3_lE6Vo7CzumMNVK2emA2yrZ9xmB6Y-VaTDo' -H "Content-Type:text/uri-list" --data 'https://../server/api/core/items/f05957bc-66c2-4b02-bff3-d824fe49d11d \n https://.../server/api/core/items/4af1fd76-fd7d-4924-817c-d4c4c47db01c' Error: Note: Unnecessary use of -X or --request, POST is already inferred. * Trying 159.93.33.231... * TCP_NODELAY set * Connected to ... (...) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * TLSv1.3 (OUT), TLS handshake, Client hello (1): * TLSv1.3 (IN), TLS handshake, Server hello (2): * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8): * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, Certificate (11): * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, CERT verify (15): * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, Finished (20): * TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1): * TLSv1.3 (OUT), TLS handshake, [no content] (0): * TLSv1.3 (OUT), TLS handshake, Finished (20): * SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 * ALPN, server accepted to use http/1.1 * Server certificate: * subject: CN=... * start date: Mar 17 07:18:59 2025 GMT * expire date: Jun 15 07:18:58 2025 GMT * subjectAltName: host "...." matched cert's "...." * issuer: C=US; O=Let's Encrypt; CN=R11 * SSL certificate verify ok. * TLSv1.3 (OUT), TLS app data, [no content] (0): > POST /server/api/core/relationships?relationshipType=1 HTTP/1.1 > Host: .... > User-Agent: curl/7.61.1 > Accept: */* > Cookie: DSPACE-XSRF-COOKIE={csrf-token} > X-XSRF-TOKEN: {csrf-token} > Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJlaWQiOiI1ODg4MzU2NC00ZmFmLTQxY2QtYmY1Ny1iNTJiOWY2M2FhYjIiLCJzZyI6W10sImF1dGhlbnRpY2F0aW9uTWV0aG9kIjoicGFzc3dvcmQiLCJleHAiOjE3NDM0MDg0NzV9.WcWjWZn3_lE6Vo7CzumMNVK2emA2yrZ9xmB6Y-VaTDo > Content-Type:text/uri-list > Content-Length: 166 > * upload completely sent off: 166 out of 166 bytes * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS handshake, [no content] (0): * TLSv1.3 (IN), TLS handshake, Newsession Ticket (4): * TLSv1.3 (IN), TLS app data, [no content] (0): < HTTP/1.1 422 HTTP/1.1 422 < Date: Mon, 31 Mar 2025 07:37:55 GMT Date: Mon, 31 Mar 2025 07:37:55 GMT < Server: Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k Server: Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k < Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers < Content-Language: en,ru Content-Language: en,ru < X-Content-Type-Options: nosniff X-Content-Type-Options: nosniff < X-XSS-Protection: 1; mode=block X-XSS-Protection: 1; mode=block < Cache-Control: no-cache, no-store, max-age=0, must-revalidate Cache-Control: no-cache, no-store, max-age=0, must-revalidate < Pragma: no-cache Pragma: no-cache < Expires: 0 Expires: 0 < Strict-Transport-Security: max-age=31536000 ; includeSubDomains Strict-Transport-Security: max-age=31536000 ; includeSubDomains < X-Frame-Options: DENY X-Frame-Options: DENY < Content-Type: application/json;charset=UTF-8 Content-Type: application/json;charset=UTF-8 < Access-Control-Allow-Origin: https://.... Access-Control-Allow-Origin: https://.... < Access-Control-Allow-Methods: GET, POST, OPTIONS, PATCH, DELETE 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-Headers: Content-Type, Authorization, x-referrer, x-correlation-id, x-xsrf-token < Access-Control-Allow-Credentials: true Access-Control-Allow-Credentials: true < Transfer-Encoding: chunked Transfer-Encoding: chunked < * TLSv1.3 (IN), TLS app data, [no content] (0): * Connection #0 to host .... left intact {"timestamp":"2025-03-31T07:37:55.238+00:00","status":422,"error":"Unprocessable Entity","message":"Unprocessable or invalid entity","path":"/server/api/core/relationships"} 422 Unprocessable Entity - if one of the items doesn't exist *but - both items exist and accessible.* used the instructions: https://github.com/DSpace/RestContract/blob/main/relationships.md#creating-a-relationship Any thoughts on how to solve this problem? Best regards, Alex -- 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/163f43dc-5996-4fa6-ba8c-cc8b30167afbn%40googlegroups.com.
