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

Update get file endpoint to add a datasetVersion optional query parameter and extend its payload #10280

Closed
MellyGray opened this issue Jan 29, 2024 · 2 comments · Fixed by #10299
Assignees
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: 10 A percentage of a sprint. 7 hours. SPA: File Page SPA These changes are required for the Dataverse SPA Type: Feature a feature request User Role: API User Makes use of APIs
Milestone

Comments

@MellyGray
Copy link

MellyGray commented Jan 29, 2024

Overview of the Feature Request

Update the Get JSON Representation of a File endpoint to include a datasetVersion optional query parameter. This parameter would allow users to specify the datasetVersion of the file they wish to retrieve, in the same way that happens when using the Get JSON Representation of a Dataset endpoint

Example /api/files/:persistentId/datasetVersion/3.0?persistentId=doi:10.70122/FK2/QJANR3/J2MR4Q

A part from the new datasetVersion query parameter we also want to include the dataset version information in the payload. This will allow the SPA to display the File Page with all the dataset version data that used to appear in the JSF UI.

This is the dataset version information needed in the SPA:

versionId: number
displayName: string
versionNumber: {majorNumber?: number, minorNumber?: number}
publishingStatus: string
citation: string
isLatest: boolean
isInReview: boolean
latestVersionPublishingStatus: string

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

What inspired the request?

This request is inspired by the need to access specific versions of files metadata to display them in the SPA.

This conversation inspired the request:

What existing behavior do you want changed?

The 'Get JSON Representation of a File' endpoint

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

Allow API users to specify the dataset version of the file they wish to retrieve.

Modify the get file endpoint to match the structure of the get dataset endpoint

Any open or closed issues related to this feature request?

@MellyGray MellyGray added Type: Feature a feature request 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 SPA These changes are required for the Dataverse SPA labels Jan 29, 2024
@qqmyers
Copy link
Member

qqmyers commented Jan 29, 2024

FWIW: There are two things that can happen with files. The metadata (including filename) can be updated in a new dataset version and a file can be uploaded to replace a file in the previous version.

In the former case, it is the same file id/DOI but the version that is relevant is the dataset version - there isn't really a version number for the file itself. If you just resolve the DOI, I think the current UI shows the file as it exists in the latest published version or, if it isn't in the latest published version, as it was in the first version it was in. (Perhaps odd - but the DOI points to the file page w/o any version info so some default choice has to be made).

In the latter case, it has a separate id and DOI (if file PIDs are on), so nominally no version info is needed to see the right file. (While Dataverse tracks whether one file replaced another, I don't think the current UI lets you see that at all (at least not on the file page). You just see the set of files in a dataset version on the dataset page and can then go the the file that is in that version by using it's id/DOI to get to the right file page.).

If I understand this issue is really only aimed at the first case. For the API, I wonder if it would make more sense to have an optional query parameter, e.g. ?datasetVersion= or ?inVersion= to make it clearer that it is not a file version (and that there may not be a /versions/1.0 of the file if it wasn't in dataset version 1.0) - though we do already appear to have /draft as an optional path parameter to get the json for a file in the draft dataset version.

@MellyGray
Copy link
Author

Thanks for the explanation!

I think the issue pertains to the first case, where the file metadata is updated between dataset versions.

Let me see if I have understood correctly: It's not possible to have a dataset with version=1.0 that includes a file with version=2.0. The version of the file always refers to the dataset version. So, in the UI, when I'm accessing https://demo.dataverse.org/file.xhtml?fileId=2111563&version=3.1, it actually means https://demo.dataverse.org/file.xhtml?fileId=2111563&datasetVersion=3.1.

Therefore, the correct request for this issue would be to ask for the addition of an optional datasetVersion query parameter to the endpoint

I add @ekraffmiller to the conversation so she's aware of this, since she is reviewing the related js-dataverse PR

@MellyGray MellyGray changed the title Update get file endpoint to add a version param Update get file endpoint to add a datasetVersion param Jan 30, 2024
@MellyGray MellyGray changed the title Update get file endpoint to add a datasetVersion param Update get file endpoint to add a datasetVersion optional query parameter Jan 30, 2024
@GPortas GPortas changed the title Update get file endpoint to add a datasetVersion optional query parameter Update get file endpoint to add a datasetVersion optional query parameter and extend its payload Jan 31, 2024
@GPortas GPortas added the Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) label Jan 31, 2024
@GPortas GPortas self-assigned this Feb 5, 2024
@GPortas GPortas added Size: 10 A percentage of a sprint. 7 hours. and removed Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) labels Feb 15, 2024
GPortas added a commit that referenced this issue Feb 19, 2024
GPortas added a commit that referenced this issue Feb 20, 2024
@pdurbin pdurbin added this to the 6.2 milestone Feb 23, 2024
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: 10 A percentage of a sprint. 7 hours. SPA: File Page SPA These changes are required for the Dataverse SPA Type: Feature a feature request User Role: API User Makes use of APIs
Projects
None yet
4 participants