You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot retrieve any type of identifier from the files created with uploadFile method since it does not return any information of the created file #16
When using the uploadFile method, it uses internally the method deposit from class UploadFile. Method deposit returns a DepositReceipt that contains the result of the operation, for example the identifier of the file that you uploaded, but the method uploadFile does not return anything. This makes impossible to keep manipulating the file for example for metadata addition because you are not returning the identification.
¿Could you please explain if this is the intentional design? ¿Is there a possible workaround to obtain the id of the file that you updated with the uploadFile method?
If not I will raise another pull request to fix this or add another method that has this behaviour.
That is to say, from what I can tell, no, with SWORD we don't give you the database ID of the file in the deposit receipt. You have to make a separate call to the get the statement. Yes, this is pretty sub-optimal. The native (JSON) API works in a more sane manner, returning the database ID of the file when you upload the file.
For reference, this is what I'm seeing as output when you upload a file via SWORD (no "database ID 7" or whatever):
Activity
pdurbin commentedon Nov 21, 2022
The workaround we use in tests is to retrieve the SWORD statement using a method called getFileIdFromSwordStatementBody: https://github.com/IQSS/dataverse/blob/v5.12.1/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java#L1003
That is to say, from what I can tell, no, with SWORD we don't give you the database ID of the file in the deposit receipt. You have to make a separate call to the get the statement. Yes, this is pretty sub-optimal. The native (JSON) API works in a more sane manner, returning the database ID of the file when you upload the file.
For reference, this is what I'm seeing as output when you upload a file via SWORD (no "database ID 7" or whatever):
otter606 commentedon Nov 21, 2022
Hi, I'm working on supporting native API file upload, will do a PR soon. I don't think this was available last time I looked which was a while ago.
pdurbin commentedon Nov 22, 2022
@otter606 fantastic! It's been great watching you and @AleixMT breathe new life into this library! Go go go!
otter606 commentedon Nov 26, 2022
PR #23 contains a fix for this if anyone wants to take a look.
AleixMT commentedon Nov 26, 2022
@pdurbin Thanks for the workaround. Since a PR is incoming I hope that I can use the method the way I needed it :D
Thank you for your time and work @otter606 , I will take a look to PR #23
richarda23 commentedon Feb 28, 2023
closing, assumed done