Page History
...
Method | Endpoint | Description |
---|---|---|
GET | / | REST API static documentation page |
POST | /login | Login to the REST API using a DSpace EPerson (user). It returns a
Example Request: # Can use either POST or GET (POST recommended). Must pass the parameters "email" and "password". curl -v -X POST --data "email=admin@dspace.org&password=mypass" https://dspace.myu.edu/rest/login Example Response: HTTP/1.1 200 OK Set-Cookie: JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8; Path=/rest/; Secure; HttpOnly Example of using JSESSIONID cookie for subsequent (authenticated) requests: curl -v --cookie "JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8" https://dspace.myu.edu/rest/status # This should return <authenticated>true</authenticated>, and information about the authenticated user session Invalid email/password combinations will receive an Please note, special characters need to be HTTP URL encoded. For example, an email address like |
POST | /logout | Logout from the REST API, by providing a Example Request: codecurl -v -X POST --cookie "JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8" https://dspace.myu.edu/rest/logout After posting a logout request, cookie is invalidated and the "/status" path should show you as unauthenticated (even when passing that same cookie). For example: codecurl -v --cookie "JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8" https://dspace.myu.edu/rest/status
# This should show <authenticated>false</authenticated> Invalid token will result in HTTP 400 Invalid Request |
GET | /test | Returns string "REST api is running", for testing that the API is up. Example Request: codecurl https://dspace.myu.edu/rest/test Example Response: codeREST api is running. |
GET | /status | Receive information about the currently authenticated user token, or the API itself (e.g. version information). Example Request (XML by default): codecurl -v --cookie "JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8" https://dspace.myu.edu/rest/status Example Request (JSON): codecurl -v -H "Content-Type: application/json" -H "Accept: application/json" --cookie "JSESSIONID=6B98CF8648BCE57DCD99689FE77CB1B8" https://dspace.myu.edu/rest/status Example JSON Response: code{"okay":true,"authenticated":true,"email":" dspacedemo+admin@gmailadmin@dspace.com org","fullname":"DSpace Administrator","sourceVersion":"6.0","apiVersion":"6"} |
Communities
Communities in DSpace are used for organization and hierarchy, and are containers that hold sub-Communities and Collections. (ex: Department of Engineering)
...