Ckan 2.10, Create_Package Failing with Bad Request Error

20 views Asked by At

Experiencing an issue calling Ckan RPC API using the simple urlopen approach. I receive an HTTPError 400 - Bad Request. I expect the headers are not formatted correctly. I also can't find the log file to try to get a more detailed error. Any idea what might be causing this?

Steps to reproduce Steps to reproduce the behavior:

dataset_dict = {
'name': name,
'notes': notes,
'owner_org': owner_org
}

myurl = 'http://ckan.mydomain.com/api/3/action/package_create'
request = urllib.request.Request(myurl)

request.add_header('Authorization', 'Bearer ' + key)
request.add_header('X-CKAN-API-Key', key)
request.add_header('Content-Type', 'application/json')
request.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1)')

response = urlopen(request, data_string)

Expected behavior I would expect a 200 status response and a package / data product created.

0

There are 0 answers