REST API DSpace 7.1

297 views
Skip to first unread message

Kosmas Kaifel

unread,
Nov 8, 2021, 2:48:10 AM11/8/21
to DSpace Technical Support
Good morning,

can someone give me an example, how can I login into the REST-API via curl.

Best Regards
Kosmas

--
+---------------------------------------------------------------+
Universität Ulm
Kommunikations- und Informationszentrum (kiz)
Abt. Informationsmedien
Albert-Einstein-Allee 37
89081 Ulm
Tel. 0731/50-15495
EMail: kosmas...@uni-ulm.de
+----------------------------------------------------------------+

Michael Plate

unread,
Nov 8, 2021, 5:21:58 AM11/8/21
to dspac...@googlegroups.com
Hi Kosmas,

Am 08.11.21 um 08:48 schrieb Kosmas Kaifel:
> Good morning,
>
> can someone give me an example, how can I login into the REST-API via curl.
[…]

tried upgrading our DSpace5 last Friday and tested the login to the API:


curl -c - -XGET https://<YOUR-SERVER>/server/api/login

You will get a Cookie named "DSPACE-XSRF-COOKIE" and its value.

Now try

curl -i -b "DSPACE-XSRF-COOKIE=<YOUR-COOKIE>" -H "X-XSRF-TOKEN:
<YOUR-COOKIE>" -XPOST https://<YOUR-SERVER>/server/api/authn/login -d
'user=YOUR-USER&password=YOUR-PASSWORD'

In the answer you will receive a new DSPACE-XSRF-TOKEN and a Bearer
Token you need for further access.


https://wiki.lyrasis.org/display/DSPACE/REST+Authentication
https://github.com/DSpace/RestContract/blob/main/csrf-tokens.md

CU

Michael

Tim Donohue

unread,
Nov 8, 2021, 10:26:12 AM11/8/21
to Kosmas Kaifel, DSpace Technical Support
Hi Kosmas,

You can find information on logging in directly to the REST API in our REST Contract documentation at https://github.com/DSpace/RestContract/blob/main/authentication.md

Tim

From: dspac...@googlegroups.com <dspac...@googlegroups.com> on behalf of Kosmas Kaifel <kosmas...@uni-ulm.de>
Sent: Monday, November 8, 2021 1:48 AM
To: DSpace Technical Support <dspac...@googlegroups.com>
Subject: [dspace-tech] REST API DSpace 7.1
 
--
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 dspace-tech...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/c3121bcc-b372-7692-7aec-5b31357419c8%40uni-ulm.de.

Kosmas Kaifel

unread,
Nov 9, 2021, 5:54:34 AM11/9/21
to dspac...@googlegroups.com
Hi Michael,

thank you for the anwser.
Now it works.

Kosmas
Reply all
Reply to author
Forward
0 new messages