-
Notifications
You must be signed in to change notification settings - Fork 479
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
8339 file data api #9269
8339 file data api #9269
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code, docs, and tests are looking good!
I mentioned to @sekmiller that he's using a non-default format for file DOIs but it's completely legit and shorter in the docs so I think it's fine. Others, please speak up if you think it's important the change. Details in the review.
I ran the code locally and the JSON output looks good to me.
@kcondon one addition to the JSON is categories (file tags in the UI), which I didn't test. If you could try exercising this, I'd appreciate it. I guess we could also add an automated test for categories. Please let us know if you want this.
Here's some example JSON that came out of me running the new API test (all other API test are passing in Jenkins, by the way):
{
"status": "OK",
"data": {
"description": "",
"label": "stata13-auto-withstrls.dta",
"restricted": false,
"version": 1,
"datasetVersionId": 1,
"dataFile": {
"id": 4,
"persistentId": "",
"pidURL": "",
"filename": "stata13-auto-withstrls.dta",
"contentType": "application/x-stata-13",
"filesize": 8854,
"description": "",
"storageIdentifier": "s3://pdurbin:185a14c1549-769c167d9eeb",
"rootDataFileId": -1,
"md5": "6ce6be68c8b8bccf08c1b7ba5e924e5a",
"checksum": {
"type": "MD5",
"value": "6ce6be68c8b8bccf08c1b7ba5e924e5a"
},
"creationDate": "2023-01-11"
}
}
}
|
||
.. note:: Files can be accessed using persistent identifiers. This is done by passing the constant ``:persistentId`` where the numeric id of the file is expected, and then passing the actual persistent id as a query parameter with the name ``persistentId``. | ||
|
||
Example: Getting the file whose DOI is *10.5072/FK2/J8SJZB*: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This format (10.5072/FK2/J8SJZB) is the :DataFilePIDFormat=INDEPENDENT ( https://guides.dataverse.org/en/5.12.1/installation/config.html#datafilepidformat ) but DEPENDENT (10.5072/FK2/J8SJZB/MLGWJO) is the default. INDEPENDENT is shorter, which is nice for docs, but DEPENDENT is more common in the wild, I assume. I'm fine keeping this as is. I just thought I'd point it out.
size for the next sprint: 10 |
Basic endpoint seems to work ok, json is downloaded. [Kevin] restricted field value seems to report the published state, even if draft has changed. I think that is how we view restricted as a state -whatever the published version's restricted state is determines state across all versions. |
I implemented 'draft' and updated the doc. I think this is all that is pending. |
Still seeing the draft description as a user without view draft perms. |
Retested and this works fine now. Ready to merge, waiting for integration tests to complete. |
sprint kickoff
|
What this PR does / why we need it: Adds an api endpoint to get file metadata and info from the datafile in json format
Which issue(s) this PR closes:
Special notes for your reviewer:
Suggestions on how to test this:
Does this PR introduce a user interface change? If mockups are available, please link/include them here: No
Is there a release notes update needed for this change?:
Additional documentation: Doc added to file section of Native API