Hi
I tried to update the file metadata, but it did't work according to the instructions https://guides.dataverse.org/en/5.12.1/api/native-api.html#updating-file-metadata
I got the metadata with:
curl https://data.aussda.at/api/files/735/metadata
output:
{"label":"20001_ta_de_v1_0.pdf","description":"GfK-1: Tabellenband","restricted":true,"categories":["Data","Research report"],"id":818}
But update with:
curl -H "X-Dataverse-key:xxx" -X POST \
-F 'jsonData={"label":"20001_ta_de_v1_0.pdf","description":"GfK-1: Tabellenband new","restricted":true,"categories":["Data","Research report"],"id":818}' \
"https://dv03.aussda.at/api/files/735/metadata"
Brings the error:
{"status":"ERROR","message":"Filename already exists at 20001_ta_de_v1_0.pdf"}
I followed the guide “so if you want to update a specific field first get the json with the above command and alter the fields you want.”, what could be the problem?
I tried it also at the demo server with the same error:
curl -H "X-Dataverse-key:xxx" -X POST \
-F 'jsonData={"label":"test.txt","description":"file_test_new","restricted":false,"id":1888197}' \
https://demo.dataverse.org/api/files/2092597/metadata
On demo I used persistendId, the file Id didn’t work:
curl https://demo.dataverse.org/api/files/2092597/metadata
{"status":"ERROR","message":"Error attempting get the requested data file.}
Thank you,
best regards
Christian
Hi Julian,
thank you! You’re right, file metadata update (without update of the label) is only possible when the dataset is in draft status. Is this behaviour intentional? If yes, the documentation should be adapted.
What about getting file metadata, with file Id it doesn’t work anymore:
curl https://demo.dataverse.org/api/files/2092597/metadata
With persistent Id everythin ok:
A bug in Version 6.0?
Best regards
Christian

https://github.com/IQSS/dataverse/issues/8542 and https://github.com/IQSS/dataverse/issues/9676 are about the same problem, updating file metadata is only possible when the dataset is in draft status.
Thanks for the clarification file Id vs database Id. The id 1888337 from the JSON return, there is this information in the documentation: “Note: The id returned in the json response is the id of the file metadata version.”
It’s all a little bit confusing…
Best regards & thank you again
Christian
--
You received this message because you are subscribed to the Google Groups "Dataverse Users Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dataverse-commu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dataverse-community/d949eaf5-d4c1-4555-ae80-f8e1c640e098n%40googlegroups.com.