Hi Everyone, I added a customized metadata block and can add metadata to the new fields at the front end, but failed to import Json files containing the customized metadata. It seems the new block need to be added to ImportDDIServiceBean.java and ImportGenericServiceBean.java to make the API work. Is it the right way to do it? Are there easier solutions? Thanks!
Huh. It should work! Here's what I'd suggest...
Of course, you might be talking about importing a new dataset rather than importing. But I'd start with creating first to make sure it's working.
Hi Philip, Thanks for your great recommendations. I will give it a try. One thing I want to mention is that I decompiled and looked at the import class file after adding the custom metadata block, but did not see any of the custom metadata fields. Is that what it supposed to be?
Well, it should all be written generically. I wouldn't expect you to see specific fields in the decompiled output.
We have a custom metadata block and have been creating datasets with the customization fields via API. I have not touched any of the "ServiceBean" files.
To set up our custom metadata block we followed the instructions here:
https://guides.dataverse.org/en/latest/admin/metadatacustomization.html
Once you have created a ".tsv" file (properly formatted), then you 1) enable the metadata block, 2) update the Solr schema with the "update-fields.sh" script, 3) reload your Solr schema.
If you can add metadata via the UI, then seems you have done the above steps.
I would do what @Philip Durbin suggests above -
I would export the dataset you created via the UI to see how the json is rendered and use that json as an example to create a new dataset via the API.
curl "$SERVER/api/datasets/export?exporter=dataverse_json&persistentId=doi:$DOI"
I just tried with an exported Json containing the metadata block. It seems the import worked with this message: {"status":"OK","data":{"id":17,"persistentId":"doi:10.5072/FK2/VRXQQ2"}}. But the dataset does not show up in the app. I did the import again and it says the dataset already exists.
If the dataset exists, it should just make a "draft", right @Philip Durbin
@Hansen Zhang if you go to the dataset, in the UI, do you see other versions? Click the "Versions" tab. You should see something like this:
Screenshot-2024-09-03-at-3.29.42PM.png
Also who "owns" the dataset? If you are not logged in (and it was your token that created the dataset), you will not be able to see the dataset - until it is published.
I am doing it in a development environment. The imported dataset did not show up at all, although status was OK.
I am doing it as the Admin and I logged in.
Hi Philip and Sherry, I tried to upload the exported Json file to Dataverse in production. It worked. I have no idea what's wrong with my local installation. Thank you for your help!
Oh, great! I'm glad it worked in prod.
Last updated: Oct 30 2025 at 06:21 UTC