Create project from file API call

I’m updating a fork of the python openrefine-client API to Python 3 for compatibility purposes, and I’m looking for more information on what format the create-project-from-file API command requires in the project-file field of the data form. The python cli refers to a dict but doesn’t have any further specifications.

Welcome to the forum @unixrubix. I’ve moved this question into the “Development” topic as I suspect it might get a bit more attention there. Note that the APIs in OpenRefine are not specifically designed for external use and so are subject to change without notice and aren’t generally documented outside the code base. That said I know many people have found the external client libraries very useful in the past so it’s great to hear you are working on updating the python client to be Python 3 compatible.

I suspect @felixlohmeier might be able to offer some comment as they have maintained a version of the Python OpenRefine client for sometime and I think have looked at the possibility of updating for Python 3 in the past - see port to python 3.7 and use requests by wolfv · Pull Request #8 · opencultureconsulting/openrefine-client · GitHub (and also see this attempt GitHub - wolfv/openrefine-client at py3_port - not sure what state that’s in)

Thanks Owen for the mention. I’m afraid no one has gotten further than wolfv so far.

For the specific question, the OpenRefine API doc might be helpful: OpenRefine API | OpenRefine.

When uploading files you will need to send the data as multipart/form-data. This is different to all other API calls which use a mixture of query string and POST parameters.

  'project-file' : file contents
  'project-name' : project name
  'format' : format of data in project-file (e.g. 'text/line-based/*sv') [optional]
  'options' : json object containing options relevant to the file format [optional - however, some importers may have required options, such as `recordPath` for the JSON & XML importers].