Working example of API file metadata update on STATA file?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 564
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 29
Description
What steps does it take to reproduce the issue?
I am trying to recreate https://guides.dataverse.org/en/5.13/api/native-api.html#updating-file-metadata on some STATA file metadata I have but I have tried just about everything with no luck. I requested the existing file metadata using https://demo.dataverse.org/api/files/:persistentId/metadata?persistentId=doi:10.70122/FK2/YUUS5M/77CV8Z with no problem.
When I try to update the metadata with additional information using the following terminal commands...
export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org/api/files/:persistentId/metadata?persistentId=doi:10.70122/FK2/YUUS5M/77CV8Z
curl -H "X-Dataverse-key:$API_TOKEN" -X POST \
-F 'jsonData={"label": "F1_SUBJECT.tab", "directoryLabel": "data/reference", "description": "This is the first file generated for this dataset and contains the participant/subject reference IDs, basic subject demographics, PA knee KL grades and reported pain in knees.", "restricted": false, "id": 1869963, "strFileName": "F1_SUBJECT"}' \
$SERVER_URL
...I receive the following error:
{"status":"ERROR","message":"Filename already exists at data/reference/F1_SUBJECT.tab"}
This error message seems a bit odd considering I am not trying to replace an existing file, but only the metadata. What am I missing?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Updating File Metadata section of the Native API guide and reproduce the shown curl request against the reported file-metadata endpoint. Determine whether the example or the endpoint behavior explains the existing-filename error, then update the documentation with a verified working example and expected result.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100