Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a delete file endpoint available? #3913

Closed
leeper opened this issue Jun 15, 2017 · 12 comments · Fixed by #9383
Closed

Is a delete file endpoint available? #3913

leeper opened this issue Jun 15, 2017 · 12 comments · Fixed by #9383
Labels
Feature: API Hackathon: More APIs Add new or missing API endpoints User Role: API User Makes use of APIs
Milestone

Comments

@leeper
Copy link
Member

leeper commented Jun 15, 2017

The native API currently allows file update (and now file replace) operations but it doesn't appear to allow file delete. This means that because replace only works on published files, it is not possible to update the file contents of a draft dataset without going through the GUI to manually delete the staged file or to delete the entire draft (all files and metadata) through the API. It would be great to be able to delete both unpublished/draft files and to delete files generally from a version (in the way that is currently possible through the GUI).

@pdurbin
Copy link
Member

pdurbin commented Jun 15, 2017

@leeper well, as I mentioned in person today, you could use SWORD to delete a file but you're right that there's no "native" API to delete a file. See also #3419 and for all I know #2464 is still a bug. #2222 is also related.

@pdurbin
Copy link
Member

pdurbin commented Jun 23, 2017

@leeper thanks for your feedback. I copied your comment into #3419 where the work would be done and am closing this issue.

@pdurbin pdurbin closed this as completed Jun 23, 2017
@pdurbin
Copy link
Member

pdurbin commented Jun 28, 2018

On second thought, I like the way this issue is worded and how it's from a real user rather than me so I'm re-opening it and closing the duplicate #3419

@pdurbin pdurbin reopened this Jun 28, 2018
@pdurbin pdurbin added the User Role: API User Makes use of APIs label Jul 13, 2018
@qqmyers
Copy link
Member

qqmyers commented Oct 13, 2020

FWIW: #7149 is about adding the ability to replace files in draft versions, so it addresses the original use case above. (working on a PR)

@janvanmansum
Copy link
Contributor

I am interested in the last use case "deleting files from a (draft) version similar to the UI". Would it make sense to have a new API endpoint similar to "replace" but which deletes the file from the current draft (and creates a draft if the last version is a published version)?

I imagine calling that endpoint would look like this for persistent IDs.

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export PERSISTENT_ID=doi:10.5072/FK2/AAA000

curl -H "X-Dataverse-key:$API_TOKEN" -X POST  "$SERVER_URL/api/files/:persistentId/delete?persistentId=$PERSISTENT_ID"

And for database IDs:

export API_TOKEN=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
export SERVER_URL=https://demo.dataverse.org
export ID=5

curl -H "X-Dataverse-key:$API_TOKEN" -X POST  "$SERVER_URL/api/files/$ID/delete"

@pdurbin
Copy link
Member

pdurbin commented Oct 14, 2020

@janvanmansum yes, that makes perfect sense. Thanks for leaving a comment here. As I mentioned in the thread on the mailing list, the current work around is to use the SWORD API: http://guides.dataverse.org/en/5.1.1/api/sword.html#delete-a-file-by-database-id

@joenio
Copy link

joenio commented Nov 20, 2020

I'm doing this comment here just to let you know that there is +1 user wanting this feature of deleting files using the Native API.

@cmbz
Copy link

cmbz commented Mar 3, 2022

Yet another user who would also like this capability in the Native API.

@pallinger
Copy link
Contributor

I also concur. It would be a useful feature to be able to delete files using the native API.

@pdurbin pdurbin added the Hackathon: More APIs Add new or missing API endpoints label Oct 10, 2022
@kmika11
Copy link
Contributor

kmika11 commented Nov 14, 2022

Just adding another comment to mention that we're seeing tickets from Harvard Dataverse users asking for this ability using the Native API

@foobarbecue
Copy link
Contributor

I need to programmatically delete a lot of files now so this would be really helpful! I guess it's time to learn to use SWORD.

@pdurbin pdurbin moved this from New to Community Backlog (Phil) in IQSS Dataverse Project Dec 6, 2022
@pdurbin
Copy link
Member

pdurbin commented Dec 6, 2022

Thanks all. I just added it to the community backlog column in the new global backlog board: https://github.com/orgs/IQSS/projects/34/views/1

However, it's currently at the bottom of that column because I'm prioritizing pull requests. (If the work is already done, we should get those improvements in, right?)

Speaking of pull requests, is anyone out there interested in making one for this issue? If so, please get in touch! 😄

pdurbin added a commit to ErykKul/dataverse that referenced this issue Mar 15, 2023
pdurbin added a commit to pdurbin/dataverse that referenced this issue Mar 28, 2023
pdurbin added a commit to pdurbin/dataverse that referenced this issue Mar 28, 2023
Rather than the order in the datasets, which seems to be
undeterministic. Not sure.
pdurbin added a commit to pdurbin/dataverse that referenced this issue Mar 28, 2023
pdurbin added a commit to ErykKul/dataverse that referenced this issue Mar 28, 2023
pdurbin added a commit to ErykKul/dataverse that referenced this issue Mar 28, 2023
@pdurbin pdurbin added this to the 5.14 milestone Apr 27, 2023
@cmbz cmbz moved this from Community Backlog (Phil) to SPRINT- NEEDS SIZING in IQSS Dataverse Project May 15, 2023
@cmbz cmbz moved this from SPRINT- NEEDS SIZING to Clear of the Backlog in IQSS Dataverse Project May 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: API Hackathon: More APIs Add new or missing API endpoints User Role: API User Makes use of APIs
Projects
Status: No status
Status: Done
Development

Successfully merging a pull request may close this issue.

9 participants