dataverse-client-python icon indicating copy to clipboard operation
dataverse-client-python copied to clipboard

Update of metadata fails when dataset contains files

Open chStaiger opened this issue 7 years ago • 1 comments

I am trying to update the metadata of a dataset. It works fins as long as the dataset does not contain any files. When the dataset contains files, I receive:

In [34]: dataset.update_metadata(metadata)
---------------------------------------------------------------------------
OperationFailedError                      Traceback (most recent call last)
<ipython-input-34-035088be5019> in <module>()
----> 1 dataset.update_metadata(metadata)

/home/admincentos/src/dataverse/dataverse/dataset.pyc in update_metadata(self, metadata)
    236
    237         if resp.status_code != 200:
--> 238             raise OperationFailedError('JSON metadata could not be updated.')
    239
    240         updated_metadata = resp.json()['data']

OperationFailedError: JSON metadata could not be updated.

The http request fails with error code 500:

resp = requests.put(
    url,
    headers={'Content-type': 'application/json'},
    data=json.dumps(md),
    params={'key': dataset.connection.token}
)

print resp.status_code, resp.reason
500 Internal Server Error

chStaiger avatar Apr 25 '18 15:04 chStaiger

@chStaiger hi! This is a problem on the Dataverse server side. Can you please open an issue at https://github.com/IQSS/dataverse/issues ?

Thanks!

p.s. https://github.com/IQSS/dataverse/pull/4566 is related but includes a lot of extra information. Here's where we document how to use that "edit dataset metadata using JSON" API (not in a released version of Dataverse yet): https://github.com/IQSS/dataverse/blob/db2d39ff7d53d9df9ec4646f0530a97deae6d464/doc/sphinx-guides/source/api/native-api.rst#update-metadata-for-a-dataset

pdurbin avatar Apr 25 '18 17:04 pdurbin