-
Notifications
You must be signed in to change notification settings - Fork 501
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
Bug report: Json API doesn't allow round-trip of license information #9155
Comments
The example at https://guides.dataverse.org/en/latest/api/native-api.html#import-a-dataset-into-a-dataverse-collection shows adding a license. Are you using that API call or something else? The Admin API for managing licenses allows new licenses to be added to the set that are allowed. If you try importing a dataset with a license not in that list, it would be an error. Also, FWIW, the Semantic API, https://guides.dataverse.org/en/latest/developers/dataset-semantic-metadata-api.html, allows setting other fields on the terms of use and access pane. It's the only API for those fields afaik. |
Thanks!
I am using exactly that. The call is also accepted without errors, however, instead of CC0, the undefined terms are shown:
Yes, I checked the terms. Indeed, this field is returned when accessing a dataset through API. There is no Error and no result unfortunately..
Thank you very much for the hint |
FWIW: It looks like this is due to a change in the json output that wasn't reflected in the create API (but is in the documentation) - the parsing currently assumes that "license" is a string that is the name or uri, not a json object with both. So - the workaround would be to add something like "license":"CC BY 4.0" in your dataset json. The fact that the create/import APIs don't handle the same format as the output and that sending an object for the license doesn't report an error is a bug that can get queued up. |
Thanks! Yes, just putting the name works for now as a workaround. |
I've run into this issue a few times, too, as I try to help users use the "Create a Dataset in a Collection" API endpoint and forget that following the example in the documentation (the dataset-create-new-all-default-fields.json file) won't work. It sounds like we'd prefer that the API endpoint expect that the value for the "license" key be an object with both the license name and URI, to match how the license metadata is exported in the Dataverse JSON format. And that the endpoint returns an error when the value for the "license" key is anything other than an object with the license name and URI. Can we close this issue and:
|
This is how the license is exported:
and in the DatasetUtil:
But in json parser the license is looked up by the name provided, i.e. it must match the name in the license table. |
This is where the different names are specified, for
but for display and export the name from the properties bundle is used:
It's NOT just the different names though. The import appears to only accept the name as a primitive string, as in |
I'm fixing this bug as part of #9148; just put together a prototype fix.
should it still accept the current
as well? |
Yes, I think it would be nice to accept both forms. Backward compatibility is important. |
I was leaning towards leaving backward compatibility in place as well. Just checked it in (but, work in progress). |
To quote Rich Hickey: “They can say, “I am in Bermuda this week, but next week I will try foo2. That sounds awesome.” But right now, my web service is going to keep working, because it calls foo, and you did not take it away from me while I was on vacation.” From https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/Spec_ulation.md |
Closing manually because this PR was merged even though it says closed: |
Title updated. In discussion this issue we discovered that the root cause is a bug/mismatch between the JSON export and import format for licenses. A resolution to this issue should address that. (Note there is a workaround.)
Overview of the Feature Request
Dear Dataverse developers,
Unfortunately, I could not find a possibility to attach Terms to a dataset using API.
What kind of user is the feature intended for?
(Example users roles: API User, Curator, Depositor, Guest, Superuser, Sysadmin)
API User
What inspired the request?
There is a section in den docs explaining how to manage the tems dataverse-wide[1], however not how to attach them to datasets.
[1] https://guides.dataverse.org/en/latest/api/native-api.html#id202
What existing behavior do you want changed?
When I try to do it the same way that dataverse respond, the data is getting accepted, however there is no result and the dataset is created with "custom terms"
I would expect that this json would change the license to CC0
Any brand new behavior do you want to add to Dataverse?
Any related open or closed issues to this feature request?
All issues about Terms are somehow related, I guess..
Thank you very much
Sergej
The text was updated successfully, but these errors were encountered: