Closed CameronTStark closed 4 years ago
That's not how the datastore_create API call works. The ckan API only accepts files at the top level because it uses multipart form data to attach files, but only the resource_create API call accepts files for upload. Please look at the API documentation for more information. https://docs.ckan.org/en/2.8/maintaining/datastore.html#ckanext.datastore.logic.action.datastore_create
The function ckanext.datastore.logic.action.datastore_create gives the ability to pass a dict to its resource parameter with the parameters from ckan.logic.action.create.resource_create however I get an error when passing an open file as a _io.BufferedReader type in the resource_create dict.
Here's an example of my code.
The error I get is: TypeError: Object of type BufferedReader is not JSON serializable
I believe this is due to the different types of data within the dict but I imagine it's possible if the function is expecting this possibility.
Is there a way to prepare the file for the dictionary so I don't get this issue? I'm not fluent in the serialization methods and needs for POSTing through the API but maybe someone here is.
Thanks!