create explicit group fails #86
Labels
pkg:api
api related activities
prio:asap
Fix as soon as possible
status:confirmed
Is a valid issue and will be moved forward soon.
type:bug
Something isn't working
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.
The text was updated successfully, but these errors were encountered: