Updating project setting (for bundle export) via rest api & python
Hi guys, I am trying to include other datasets in the project bundle when creating a bundle using RESTapi with python. I understand that I would have to use requests.get from the endpoint: http://url/projects/project_key/settings/ and updating ['bundleExporterSettings']['exportOptions']['includedDatasetsData']. This returns a list object.
Lets say that I want to include a dataset:
dataset = { 'name' : 'sample_data.csv',
'type' : "Filesystem" }
Should I append this to the list from the get call and do a put back to the same endpoint? If so, how should one include the body in a request call?
e.g.: response = requests.put(req_url, headers=auth )
Let me know if I'm not clear enough or if more information is needed.
Edit: Tried passing the appended dictionary back to the endpoint using PUT and received and error:
'message': 'Could not parse a APIProjectSettings from request body'
Is this only possible using the python client and not from requests?
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,212 Dataiker
Hi,
We recommend using the Python API client rather than the rest of API for operations like this as built-in helpers like settings.save() will take of this for you.
You can find a full example here :
Is there a particular reason you need to use the REST API here?