When trying to create a record with at least one creator not having an ORCID, an HTTPError is raised
Traceback (most recent call last):
File "upload.py", line 90, in main
res = ensure_zenodo(
File ".../venv/lib/python3.8/site-packages/zenodo_client/api.py", line 44, in ensure_zenodo
res = create_zenodo(data, paths, **kwargs)
File ".../venv/lib/python3.8/site-packages/zenodo_client/api.py", line 53, in create_zenodo
return Zenodo(**kwargs).create(data, paths)
File ".../venv/lib/python3.8/site-packages/zenodo_client/api.py", line 123, in create
res.raise_for_status()
File ".../venv/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: BAD REQUEST for url: https://sandbox.zenodo.org/api/deposit/depositions?access_token=...
By inspecting the .json of the failed POST request, additional information is revealed
{"errors": [{"field": "metadata.creators.3.orcid",
"message": "Field may not be null."}],
"message": "Validation error.",
"status": 400}
When trying to create a record with at least one creator not having an ORCID, an
HTTPError
is raisedBy inspecting the
.json
of the failed POST request, additional information is revealedFrom the description of
creators
in https://developers.zenodo.org/#representation, it seems as if optional entries which assume their null value should not be present, rather than havingnull
in them. On top level, this is already filtered correctly https://github.com/cthoyt/zenodo-client/blob/893a601d2901113a84270a6b1b591790884c70ac/src/zenodo_client/api.py#L102-L105but the null entries occur on a nested level inside one of the creators.