Open kirkkwang opened 4 months ago
https://demo.hyku-demo.notch8.cloud/sword/
curl --request GET \
--url https://demo.hyku-demo.notch8.cloud/sword/service_document \
--header 'Content-Type: application/xml'
<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:sword="http://purl.org/net/sword/terms/" xmlns="http://www.w3.org/2007/app">
<sword:version>2.0</sword:version>
<workspace collections="2">
<atom:title>Hyrax Sword V2 server</atom:title>
<collection href="https://demo.hyku-demo.notch8.cloud/sword/collections/87d777f1-1081-43ff-96b6-3f61499531ee">
<atom:title>Collections Test</atom:title>
<accept>*/*</accept>
<accept alternate="multipart-related">
*/* </accept>
<sword:collectionPolicy>TODO: Collection Policy</sword:collectionPolicy>
<dcterms:abstract></dcterms:abstract>
<sword:mediation>true</sword:mediation>
<sword:treatment>TODO: Treatment description</sword:treatment>
<sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/BagIt</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/Binary</sword:acceptPackaging>
</collection>
<collection href="https://demo.hyku-demo.notch8.cloud/sword/collections/91c86738-5b1e-44aa-b739-4234606b6aac">
<atom:title>Subcollection test</atom:title>
<accept>*/*</accept>
<accept alternate="multipart-related">
*/* </accept>
<sword:collectionPolicy>TODO: Collection Policy</sword:collectionPolicy>
<dcterms:abstract></dcterms:abstract>
<sword:mediation>true</sword:mediation>
<sword:treatment>TODO: Treatment description</sword:treatment>
<sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/BagIt</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/Binary</sword:acceptPackaging>
</collection>
</workspace>
</service>
Get a WORK
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Shana's dogs</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets"/>
<entry>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/a83376c6-9178-4aae-b434-2ee6aafe3784"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/a83376c6-9178-4aae-b434-2ee6aafe3784"/>
</entry>
<entry>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/85a6d42f-1a14-430a-8976-e536c1f35e1f"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/85a6d42f-1a14-430a-8976-e536c1f35e1f"/>
</entry>
<dc:title>Shana's dogs</dc:title>
<dc:creator>0~shana</dc:creator>
</feed>
curl --request GET \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/32c331c3-862a-407a-b56a-17d02c315f95 \
--header 'Content-Type: application/xml
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Collections Test</title>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/87d777f1-1081-43ff-96b6-3f61499531ee/works"/>
<entry>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/87d777f1-1081-43ff-96b6-3f61499531ee/works/91c86738-5b1e-44aa-b739-4234606b6aac"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/87d777f1-1081-43ff-96b6-3f61499531ee/works/91c86738-5b1e-44aa-b739-4234606b6aac/file_sets"/>
</entry>
</feed>
Sample file:dc.xml file
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @dc.xml
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
-F metadata=@dc.xml
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
Sample file: testPackage.zip
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'Content-Disposition: attachment; filename=testPackage.zip' \
--header 'Content-Type: application/zip' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
--data-binary @testPackage.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
-F payload=@testPackage2b.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
-F payload=@testPackage2b.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
sample file: testPackageInBagit.zip
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'Content-Disposition: attachment; filename=testPackage1InBagit.zip' \
--header 'Content-MD5: 71b5839b60c2ab183ecf522771f48023' \
--header 'Content-Type: application/zip' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
--data-binary @testPackageInBagit.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record 1</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'Content-MD5: 71b5839b60c2ab183ecf522771f48023' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
-F payload=@testPackage2InBagit.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record 1</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/ \
--header 'Content-MD5: 71b5839b60c2ab183ecf522771f48023' \
--header 'Packaging: http://purl.org/net/sword/package/BagIt' \
-F payload=@testPackage2InBagit.zip
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record 1</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
curl --request GET \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>eddie baby</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8/file_sets"/>
<entry>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8/file_sets/a9d4507b-f528-4c9c-a275-b604e4ff844a"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8/file_sets/a9d4507b-f528-4c9c-a275-b604e4ff844a"/>
</entry>
<entry>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8/file_sets/f7658dce-ddf0-4147-84ca-9f0c3464ad51"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/4e815cb6-9076-4bac-a048-4c9f89aa10a8/file_sets/f7658dce-ddf0-4147-84ca-9f0c3464ad51"/>
</entry>
<dc:title>eddie baby</dc:title>
<dc:creator>0~asd</dc:creator>
</feed>
curl --request GET \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/5a8b69c3-0a5c-4dd8-a4ad-d0c6c7b54d1c
<sword:error xmlns:sword="http://purl.org/net/sword/" xmlns:arxiv="http://arxiv.org/schemas/atom" xmlns="http://www.w3.org/2005/Atom" href="http://purl.org/net/sword/error/ErrorBadRequest">
<author>
<name>Sword v2 server</name>
</author>
<title>ERROR</title>
<updated>2024-05-07T15:52:47Z</updated>
<generator uri="https://example.org/sword-app/" version="0.1">
sword@example.org </generator>
<summary>Server cannot find work with id 5a8b69c3-0a5c-4dd8-a4ad-d0c6c7b54d1c</summary>
<sword:treatment>processing failed</sword:treatment>
</sword:error>
curl --request GET \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/85a6d42f-1a14-430a-8976-e536c1f35e1f`
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>eddie-baby.jpg</title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/85a6d42f-1a14-430a-8976-e536c1f35e1f"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/a4b6eb39-3530-4a76-a35a-2e7415d2b91e/file_sets/85a6d42f-1a14-430a-8976-e536c1f35e1f"/>
<dc:title>eddie-baby.jpg</dc:title>
<dc:creator>admin@example.com</dc:creator>
</feed>
curl --request POST \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab/file_sets/ \
--header 'Content-Disposition: attachment; filename=cat_scan.pdf' \
--header 'Content-MD5: b89d04a5afefdfe3ee11a9de8b230320' \
--header 'Content-Type: application/pdf' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: admin@example.com' \
--header 'Packaging: http://purl.org/net/sword/package/Binary' \
--data-binary @cat_scan.pdf
<feed xmlns="http://www.w3.org/2005/Atom">
<title></title>
<content rel="src" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab/file_sets/b6a4235f-69d0-4ac8-a0b6-a3ba5fad295b"/>
<link rel="edit" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab/file_sets/b6a4235f-69d0-4ac8-a0b6-a3ba5fad295b"/>
</feed>
curl --request PUT \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab/file_sets/b0ddf340-8147-41f9-985d-e8121fb3b45d \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @dc.xml
curl --request PUT \
--url https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab/ \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'Packaging: application/atom+xml;type=entry' \
--data-binary @dc.xml
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Update Success</title>
<updated>2024-05-07T15:59:14+00:00</updated>
<atom:title>Hyrax Sword V2 server</atom:title>
<link rel="self" href="https://demo.hyku-demo.notch8.cloud/sword/collections/default/works/c994b933-821e-47b5-8cb9-9fc6e3468cab"/>
<entry>
<id>c994b933-821e-47b5-8cb9-9fc6e3468cab</id>
<title>Test record</title>
<content type="text">
<text>The work has been successfully updated.</text>
</content>
<updated>2024-05-07T15:55:19Z</updated>
</entry>
</feed>
BLOCKED until pals has been knapsacked.
This code currently lives and was tested in Hyku.
Compatibility issues were discovered when tested against pals knapsack valkyrie.
https://github.com/scientist-softserv/palni_palci_knapsack/issues/30
Test against Pals Knapsack Staging with an emphasis on POST requests, as that seems to be the primary focus of implementing SWORD. Note: API key is required per #1037
@kirkkwang should this request work? apologies in advance if I'm doing something silly again 🙇♀
@ShanaLMoore oh i think that's my fault, i forgot about this particular ticket, i posted my findings on the Hyku ticket, but i've brought over the test files now. I'm curious if that'll work for you. I added it at the top of the issue.
cc @ShanaLMoore To continue QA. use the files from the top of the description
curl --request POST \
--url https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works/ \
--header 'Content-Disposition: attachment; filename=metadata.xml' \
--header 'Content-Type: application/xml' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
--header 'Packaging: application/atom+xml;type=entry' \
--header 'Api-key: 9db76aff-e5da-4f9b-890a-dfaf078801cd' \
--data-binary @dc.xml
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Test record</title>
<content rel="src" href="https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works/"/>
<link rel="edit" href="https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works//file_sets"/>
</feed>
The above post request created this record
curl --request POST \
--url https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works/b8a1380f-6f53-42b6-a89f-0e6ef3b07828/file_sets/ \
--header 'Content-Disposition: attachment; filename=cat_scan.pdf' \
--header 'Content-MD5: b89d04a5afefdfe3ee11a9de8b230320' \
--header 'Content-Type: application/pdf' \
--header 'In-Progress: false' \
--header 'On-Behalf-Of: support@notch8.com' \
--header 'Packaging: http://purl.org/net/sword/package/Binary' \
--header 'Api-key: 9db76aff-e5da-4f9b-890a-dfaf078801cd' \
--data-binary @cat_scan.pdf
<feed xmlns="http://www.w3.org/2005/Atom">
<title></title>
<content rel="src" href="https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works/b8a1380f-6f53-42b6-a89f-0e6ef3b07828/file_sets/5d4946e0-8420-4691-9c16-d3a5a9a1d8df"/>
<link rel="edit" href="https://kirk.palni-palci-staging.notch8.cloud/sword/collections/default/works/b8a1380f-6f53-42b6-a89f-0e6ef3b07828/file_sets/5d4946e0-8420-4691-9c16-d3a5a9a1d8df"/>
</feed>
The above post request attached this filesetSS ✅
Fetch of a malformed endpoint with the Content-Type: application/xml
returns and HTML 404 rather than an XML response.
GET https://demo.palni-palci-staging.notch8.cloud/sword/collections/default/works
Returns:
<!DOCTYPE html>
<html>
...
<body>
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
...
This should return a SWORD sword:error
:
http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#errordocuments
Question: how do the collections named in the service document relate to collections in Hyku?
The service document at https://demo.palni-palci-staging.notch8.cloud/sword/service_document describes:
<collection href="https://demo.palni-palci-staging.notch8.cloud/sword/collections/default">
<atom:title>Default collection</atom:title>
<accept>*/*</accept>
<accept alternate="multipart-related">
*/* </accept>
<sword:collectionPolicy>TODO: Collection Policy</sword:collectionPolicy>
<dcterms:abstract></dcterms:abstract>
<sword:mediation>true</sword:mediation>
<sword:treatment>TODO: Treatment description</sword:treatment>
<sword:acceptPackaging>http://purl.org/net/sword/package/SimpleZip</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/BagIt</sword:acceptPackaging>
<sword:acceptPackaging>http://purl.org/net/sword/package/Binary</sword:acceptPackaging>
</collection>
In Hyku I see three collections, one of which I own: What is the a relationship between SWORD collections and Hyku collections?
From what i see in the willow sword gem wiki, to get a collection you would need to reference the id of that collection https://github.com/CottageLabs/willow_sword/wiki/Usage#get-collection
I don't think there's a way to get all the collections
Symplectic Elements will use OAI-PMH for discovery, so OAI-PMH would be responsible to describe the works and collections.
Currently on https://demo.palni-palci-staging.notch8.cloud/catalog/oai?verb=ListSets only collection 5ff17259-9147-43dd-a0b1-ee7aebd0a2fc (Default Admin Set) is listed.
Requesting https://demo.palni-palci-staging.notch8.cloud/sword/collections/5ff17259-9147-43dd-a0b1-ee7aebd0a2fc returns a 500 internal server error.
Requesting my own admin set (Thesis and Dissertation) also returns 500: https://demo.palni-palci-staging.notch8.cloud/sword/collections/ce5dae64-ee91-4a01-81d6-7613151e5371
Requesting 51 QA (https://demo.palni-palci-staging.notch8.cloud/sword/collections/0dac7019-ef6e-4d70-bf37-7aef2f4af3ec) or SWORD Test Collection (https://demo.palni-palci-staging.notch8.cloud/sword/collections/5f220e03-069a-4fe2-ac8e-fd0d212b6883) are successful.
Requesting https://demo.palni-palci-staging.notch8.cloud/sword/collections/default returns a "Default collection" which does not appear in the H4C UI (to me).
Specific questions:
Amending my comment above.
Elements will depend on OAI-PMH, but the SWORD v2 spec states:
The server responds with a Service Document enumerating the IRIs of a group of Collections and the capabilities of those Collections supported by the server. The content of this document can vary based on aspects of the client request, including, but not limited to, authentication credentials.
So, the available collections must be listed with their capabilities in the service document response.
@ctgraham Thanks for the context, I'll take a look at that. Just so I'm understanding, the expected behavior is that when you hit the service document endpoint, you should get back all the collections of that tenant, is that correct?
The expected behavior is that when you hit the service document endpoint, you should get back all the collections of that tenant to which you have permission to deposit content.
@jillpe just the service document needs to get retested here, let's pair on that since it's been a while
Story
files_for_testing_willow_sword.zip
The
willow_sword
gem should offer CRU (no D) functionalities for works and file_sets. Here is a list of verbs and routesAcceptance Criteria
Make sure all requests succeed:
/service_document(.:format)
Collections
/collections/:id(.:format)
Works
/collections/:collection_id/works/:id(.:format)
/collections/:collection_id/works/:id(.:format)
/collections/:collection_id/works/:id(.:format)
/collections/:collection_id/works(.:format)
File Sets
/collections/:collection_id/works/:work_id/file_sets/:id(.:format)
/collections/:collection_id/works/:work_id/file_sets/:id(.:format)
/collections/:collection_id/works/:work_id/file_sets/:id(.:format)
/collections/:collection_id/works/:work_id/file_sets(.:format)
Testing Instructions
Ref testing instruction section for HYKU but update the urls in the requests. Pals staging base url is: palni-palci-staging.notch8.cloud
DOCS:
Notes
I think using either a cURL command or something like Postman to hit these end points would work. The response should all be in xml format.