Skip to content

Comments

Update Dataset License API#11815

Merged
stevenwinship merged 20 commits intodevelopfrom
11771-set-dataset-license-api
Nov 5, 2025
Merged

Update Dataset License API#11815
stevenwinship merged 20 commits intodevelopfrom
11771-set-dataset-license-api

Conversation

@GPortas
Copy link
Contributor

@GPortas GPortas commented Sep 12, 2025

What this PR does / why we need it:

New Endpoint: /datasets/{id}/license

A new endpoint has been implemented to manage dataset licenses.

Functionality

  • Updates the license of a dataset by applying it to the draft version.
  • If no draft exists, a new one is automatically created.

Usage

This endpoint supports two ways of defining a license:

  1. Predefined License – Provide the license name (e.g., CC BY 4.0).
  2. Custom Terms of Use and Access – Provide a JSON body with the customTerms object.
    • All fields are optional except termsOfUse, which is required.

Which issue(s) this PR closes:

Suggestions on how to test this:

curl -H "X-Dataverse-key:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -X PUT "https://demo.dataverse.org/api/datasets/<dataset_id>/license" -H "Content-type:application/json" --upload-file <json_file_path>

To set a predefined license (e.g., CC BY 4.0), provide a JSON body with the license name:

  {
    "name": "CC BY 4.0"
  }

To define custom terms of use and access, provide a JSON body with the following properties. All fields within customTerms are optional, except for the termsOfUse field, which is required:

  {
    "customTerms": {
        "termsOfUse": "Your terms of use",
        "confidentialityDeclaration": "Your confidentiality declaration",
        "specialPermissions": "Your special permissions",
        "restrictions": "Your restrictions",
        "citationRequirements": "Your citation requirements",
        "depositorRequirements": "Your depositor requirements",
        "conditions": "Your conditions",
        "disclaimer": "Your disclaimer"
    }
  }

Does this PR introduce a user interface change? If mockups are available, please link/include them here:
None

Is there a release notes update needed for this change?:
Attached

@coveralls
Copy link

coveralls commented Sep 12, 2025

Coverage Status

coverage: 23.801% (+0.02%) from 23.778%
when pulling 676f834 on 11771-set-dataset-license-api
into 53bff4c on develop.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@GPortas GPortas moved this to Ready for Review ⏩ in IQSS Dataverse Project Sep 17, 2025
@GPortas GPortas added SPA These changes are required for the Dataverse SPA GREI Re-arch Issues related to the GREI Dataverse rearchitecture SPA.Q3.2025.3 Dataset Page: Edit Terms Size: 3 A percentage of a sprint. 2.1 hours. Original size: 3 labels Sep 17, 2025
@GPortas GPortas marked this pull request as ready for review September 17, 2025 18:12
@github-actions

This comment has been minimized.

@sekmiller sekmiller self-assigned this Oct 7, 2025
@sekmiller sekmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Oct 7, 2025
return ok(BundleUtil.getStringFromBundle("datasets.api.updateLicense.success"));
} else if (requestBody.getCustomTerms() != null) {
CustomTermsDTO customTerms = requestBody.getCustomTerms();
execCommand(new UpdateDatasetLicenseCommand(req, dataset, customTerms.toTermsOfUseAndAccess()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything to preserve whatever has been entered for File Access Requests or Terms of Access so it will fail if the dataset has any restricted files. In the absence of restricted files would we still want to wipe out whatever may have been entered with respect to data file access?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the other TermsOfUseAndAccess fields (originalArchive, sizeOfCollection, ...).

@sekmiller
Copy link
Contributor

@GPortas please take a look at how the setting of custom terms of will delete any entries in custom terms of access. I ended up reworking #11772 so that the api will only modify the terms of access and leave the license or custom terms of use the same as they were prior to the update. A more radical approach would have been to split the terms of use and access tables into two tables but that seemed like too much to take on here.

@cmbz cmbz added the FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) label Oct 8, 2025
@cmbz cmbz added the FY26 Sprint 9 FY26 Sprint 9 (2025-10-22 - 2025-11-05) label Oct 23, 2025
@github-actions

This comment has been minimized.

…UseAndAccess but merging new fields into the existing one
@GPortas
Copy link
Contributor Author

GPortas commented Oct 25, 2025

@sekmiller Thank you for finding the problem. I have followed a very similar approach to the one you took so we do not overwrite the whole entity, but only the custom terms of use fields.

@GPortas GPortas requested a review from sekmiller October 25, 2025 16:00
@GPortas GPortas removed their assignment Oct 25, 2025
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11771-set-dataset-license-api
ghcr.io/gdcc/configbaker:11771-set-dataset-license-api

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the update.

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Oct 29, 2025
@sekmiller sekmiller removed their assignment Oct 29, 2025
@stevenwinship stevenwinship self-assigned this Nov 5, 2025
@stevenwinship stevenwinship moved this from Ready for QA ⏩ to QA ✅ in IQSS Dataverse Project Nov 5, 2025
@stevenwinship stevenwinship merged commit 1fd4edb into develop Nov 5, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from QA ✅ to Merged 🚀 in IQSS Dataverse Project Nov 5, 2025
@stevenwinship
Copy link
Contributor

tested manually on local docker. Verified in UI and DB

@stevenwinship stevenwinship deleted the 11771-set-dataset-license-api branch November 5, 2025 15:09
@stevenwinship stevenwinship removed their assignment Nov 5, 2025
@scolapasta scolapasta moved this from Merged 🚀 to Done 🧹 in IQSS Dataverse Project Nov 5, 2025
@pdurbin pdurbin added this to the 6.9 milestone Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 6 FY26 Sprint 6 (2025-09-10 - 2025-09-24) FY26 Sprint 7 FY26 Sprint 7 (2025-09-24 - 2025-10-08) FY26 Sprint 8 FY26 Sprint 8 (2025-10-08 - 2025-10-22) FY26 Sprint 9 FY26 Sprint 9 (2025-10-22 - 2025-11-05) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Original size: 3 Size: 3 A percentage of a sprint. 2.1 hours. SPA.Q3.2025.3 Dataset Page: Edit Terms SPA These changes are required for the Dataverse SPA

Projects

Status: Done 🧹

Development

Successfully merging this pull request may close these issues.

API: Set configuring licenses and custom terms for a dataset

7 participants