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

Fix the current behavior when using the :latest tag in getVersion API calls for deaccessioned datasets and unauthenticated users #10207

Closed
GPortas opened this issue Jan 4, 2024 · 1 comment · Fixed by #10212
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 3 A percentage of a sprint. 2.1 hours. Type: Bug a defect User Role: API User Makes use of APIs
Milestone

Comments

@GPortas
Copy link
Contributor

GPortas commented Jan 4, 2024

Overview of the Feature Request

The recent introduced changes on #10191 have introduced an unexpected behavior on the Datasets getVersion API endpoint.

Currently, we can obtain a deaccessioned dataset using :latest-published tag. Example:

curl -X GET "https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/:latest-published?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true"

Or using the numeric tag (e.g. 1.0). Example:

curl -X GET "https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/1.0?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true"

But we obtain a 404 error if we use :latest tag:

curl -X GET "https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/:latest?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true"

The solution will involve modifying GetLatestAccessibleDatasetVersionCommand to handle "checkPerms" as an input parameter. This param should be set to false when the command is called from the getDataset endpoint with query params includeDeaccessioned=true and excludeFiles=true.

What kind of user is the feature intended for?
API User

What inspired the request?

What existing behavior do you want changed?

Support :latest tag in getVersion endpoint calls for deaccessioned datasets and unauthenticated users

Any brand new behavior do you want to add to Dataverse?

None

Any open or closed issues related to this feature request?

@GPortas GPortas added Type: Bug a defect User Role: API User Makes use of APIs pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows labels Jan 4, 2024
@GPortas GPortas changed the title Support :latest tag in getVersion endpoint calls for deaccessioned datasets and unauthenticated users Fix the current behavior when using the :latest tag in getVersion API calls for deaccessioned datasets and unauthenticated users Jan 4, 2024
@GPortas GPortas added the Size: 3 A percentage of a sprint. 2.1 hours. label Jan 4, 2024
@jp-tosca jp-tosca self-assigned this Jan 4, 2024
@jp-tosca
Copy link
Contributor

jp-tosca commented Jan 4, 2024

I have a follow-up regarding this issue @GPortas:

#10164 mentions that the API could not access a deaccessioned dataset if the user doesn't have edit permissions which require providing credentials.

In 6.1 all these 3 will fail:

  • Specific version

http://demo.dataverse.org/api/v1/datasets/:persistentId/versions/1.0?includeDeaccessioned=true&includeFiles=false&persistentId=doi:10.70122/FK2/IXMERS

  • Latest

http://demo.dataverse.org/api/v1/datasets/:persistentId/versions/:latest?includeDeaccessioned=true&includeFiles=false&persistentId=doi:10.70122/FK2/IXMERS

  • Latest published

http://demo.dataverse.org/api/v1/datasets/:persistentId/versions/:latest-published?includeDeaccessioned=true&includeFiles=false&persistentId=doi:10.70122/FK2/IXMERS

All these 3 will work if you provide credentials, which probably shows that this behavior was not introduced in #10191 but part of the existing issue.

The changes from #10191 address the issue from #10164 for these 2 test cases:

  • Specific version

https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/1.0?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true

  • Latest published

https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/:latest-published?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true

But failed to address this one:

  • Latest

https://beta.dataverse.org/api/v1/datasets/:persistentId/versions/:latest?persistentId=doi:10.5072/FK2/UBKVYE&includeDeaccessioned=true&excludeFiles=true

I will apply a similar fix so ":latest" is also publicly available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 3 A percentage of a sprint. 2.1 hours. Type: Bug a defect User Role: API User Makes use of APIs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants