Skip to content

Edit File Metadata API endpoint - ignoring empty values #11392

@ekraffmiller

Description

@ekraffmiller

Similar to recent changes in Edit Dataset Metadata, we need to update Edit File Metadata so that it clears fields correctly. As part of this change, the API endpoint should also include a version param, to make sure that the user is editing the correct version of the file metadata.

What steps does it take to reproduce the issue?
Try to clear out a file metadata field by passing an empty string, for example, to clear the description field. The result is that the description field is unchanged.

curl -H "X-Dataverse-key:$API_TOKEN" -X POST \
  -F 'jsonData={"description":"","label":"myname.tab", "directoryLabel": "",
               "provFreeform":"Test prov freeform","categories":["Data"],"dataFileTags":["Survey"],"restrict":false}' \
  "$SERVER_URL/api/files/$ID/metadata"
File Metadata update has been completed: {"label":"myname.tab","directoryLabel":"updated/path","description":"My description aaa.","restricted":false,"categories":["Data"],"dataFileTags":["Survey"],"id":2}
  • When does this issue occur?
    API user

  • Which page(s) does it occurs on?

  • What happens?
    The metadata field is unchanged.

  • To whom does it occur (all users, curators, superusers)?
    all API users

  • What did you expect to happen?
    The metadata field should be cleared.

Which version of Dataverse are you using?

Any related open or closed issues to this bug report?
We had a similar issue with Edit Metadata.
#11243

Screenshots:

No matter the issue, screenshots are always welcome.

To add a screenshot, please use one of the following formats and/or methods described here:

Are you thinking about creating a pull request for this issue?
Help is always welcome, is this bug something you or your organization plan to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FY25 Sprint 21FY25 Sprint 21 (2025-04-09 - 2025-04-23)GREI Re-archIssues related to the GREI Dataverse rearchitectureOriginal size: 10SPA.Q2Not related to any specific Q2 featureSize: 10A percentage of a sprint. 7 hours.Type: Buga defect

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions