Openrefine: Error in response: Missing or invalid csrf_token parameter when accessing OpenRefine through API

Created on 18 Jul 2020  路  3Comments  路  Source: OpenRefine/OpenRefine

Hi OpenRefine community,

I would like to run OpenRefine in the background and communicate with it from my app through the OpenRefine API. So far, I followed instructions outlined here: OpenRefine API

I'm running Open Refine version 3.3, and attempted to upload my files through the API both from Postman and my Python App and got the response error 'Missing or invalid csrf_token parameter'. I also found another issue raised regarding the same problem, but it was already closed.

My postman request looks like this:

Screenshot 2020-07-18 at 15 24 55

Expected Behavior


I would expect the request to upload my file(s) and create a new project, as described in the documentation.

Versions

  • Operating System: Mac OS X cataline
  • Browser Version: Safari 13
  • JRE or JDK Version: 13
  • OpenRefine: 3.3
question

All 3 comments

Hi @asyrul21, you will need to retrieve a CSRF token before making the request with GET command/core/get-csrf-token.
See https://github.com/OpenRefine/OpenRefine/wiki/Changes-for-3.3#csrf-protection-changes for more details about this.
Because this is not a bug and working as intended, I will close this, but feel free to comment back if you need more info. In general, questions like this should go to the user or developer mailing lists.

I've updated the wiki with a link to the CSRF docs and a warning that the API is internal-only and subject to change at any time (as you've just discovered).

Dear @tfmorris and @wetneb,

Thank you for your prompt response and action. I have managed to complete the POST request successfully.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings