Open veustp opened 3 years ago
As discussed during the 2024-02-14 meeting of the pyDataverse working group, we are closing old milestones in favor of a new project board at https://github.com/orgs/gdcc/projects/1 and removing issues (like this one) from those old milestones. Please feel free to join the working group! You can find us at https://py.gdcc.io and https://dataverse.zulipchat.com/#narrow/stream/377090-python
using Windows 64bit pydataverse 0.3.0 python 3.7.9 dataverse v. 4.20 build 413-4e07b62
This works: Api call using requests module to create an explicit group in the (existing) "testdv" dataverse: import json import requests gdata = { "description":"req desc", "displayName":"req dname", "aliasInOwner":"reqalias" } json_gdata = json.dumps(gdata) headers = {'X-Dataverse-key':,'Content-Type':'application/json'}
r = requests.post(baseUrl+'/api/dataverses/testdv/groups', headers=headers, data=json_gdata)
This - using the pydataverse module- for doing the same thing does not: from pyDataverse.api import NativeApi, Api import json gdata = { "description":"pdv desc", "displayName":"pdv dname", "aliasInOwner":"pdvalias" } json_gdata = json.dumps(gdata) api2 = Api(baseUrl, apiKey)
resp = api2.post_request(baseUrl+"/api/dataverses/testdv/groups",json_gdata) RESPONSE: HTTP code 415 The code suggests that the payload data is not in the correct format. It is currently being passed as a json string.
The same has also been tried using the NativeApi class with the same response (415 http code).
The post_request call did already work when testing to POST metadatablocks for a given dataverse.
Creating a group from the command line using curl did also succeed.
Maybe I'm doing something wrong here but I can't really put my finger on it - any help or confirmation on this issue is much appreciated.