Page History
...
Viralliset ohjeet löytyvät täältä. Alle päivitetään käytännön esimerkkejä.
DSpace Rest Tokenin Hakeminen
Pyyntö osoitteeseen /rest/login, json payload:
Code Block language js {"email": "[email protected]", "password": "1234"}
Esimerkkivastaus:
Code Block 8a5bd933-e679-4ad3-8b5a-dd2a77941bff
Ylempi token pitää sisällyttää rest-dspace-token headeriin, kun tekee lisäys/poisto/muokkaus operaatioita.
Itemin lisääminen (embargolla tai ilman)
Luo item: (rest osoite: /rest/collections/1/items) headerit:
Code Block rest-dspace-token: 8a5bd933-e679-4ad3-8b5a-dd2a77941bff Accept: application/json
json payload:
Code Block language js {"name": "EmbargoTesti", "metadata": [ {"key": "dc.title", "value": "EmbargoTesti"}, {"key": "dc.embargo.terms", "value": "2017-10-19"} ]}
Esimerkkivastaus:
Code Block language js { "id": 224, "name": "EmbargoTesti", "handle": null, "type": "item", "link": "/rest/items/224", "expand": [ "metadata", "parentCollection", "parentCollectionList", "parentCommunityList", "bitstreams", "all" ], "lastModified": "2017-10-18 14:52:17.299", "parentCollection": null, "parentCollectionList": null, "parentCommunityList": null, "bitstreams": null, "archived": "false", "withdrawn": "false" }
Luo bitstream: (rest osoite /rest/items/{itemId}/bitstreams?name=my_testi4.pdf&description=testitiedosto, jos haluat embargon, niin /rest/items/{itemId}/bitstreams?name=my_testi4.pdf&description=testitiedosto&groupId=0&year=2017&month=10&day=19) itemId saadaan edellisen pyynnön json vastauksesta. Tiedosto lähetetään form-datana.
Esimerkkivastaus:Code Block language js { "id": 76, "name": "my_testi4.pdf", "handle": null, "type": "bitstream", "link": "/rest/bitstreams/76", "expand": [ "parent", "policies", "all" ], "bundleName": "ORIGINAL", "description": "testitiedosto", "format": "Adobe PDF", "mimeType": "application/pdf", "sizeBytes": 741609, "parentObject": null, "retrieveLink": "/bitstreams/76/retrieve", "checkSum": { "value": "b2a29cd63a82bc03583d2562b0ac4b3c", "checkSumAlgorithm": "MD5" }, "sequenceId": -1, "policies": null }
- Nyt Item on luotu ja bitstream on lisätty.