New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception w/ apply_operations API #1356
Comments
In the 'test.json' file that you've posted there is an invisible Byte Order Mark character in the column name "Item #". My guess is that this is the problem, but I need to do some more testing to check |
Scratch that, seems like the presence of the BOM is a red herring. From what I can see the problem is with the request. If you try:
I think it will work (I could make this work locally) However, I've not yet managed to get a curl which reads the JSON from the file working - suspect this is me not quite getting the right curl incantation rather than anything else |
You can also take a look of this if you are looking for some library to do resetful operation: |
I'm at the limit of my knowledge of curl, but from a bit of poking around, it looks like to pass the content of the file to a named POST parameter, you have to use something like:
However from what I've been able to see this will only work if there are no newlines \n in the file. I think we've established this is not an OpenRefine, but a curl issue, so I'm inclined to close? @quocvu @jackyq2015 |
Just to confirm the special is not a problem. I tried w/ a different column and getting the same stacktrace
|
@ostephens it is rather surprising that you where able to use https://github.com/OpenRefine/OpenRefine/wiki/OpenRefine-API#apply-operations |
Upgrade your curl ? compare versions ? |
|
I figured it out after trying different combo. The documentation is inaccurate.
The quick fix is the documentation although I would prefer to change the code to match the documentation.
with the test.json looking like this
|
after further examination, the |
@quocvu as in my previous example, I'd suggest the simplest curl option is to use --data-urlencode having removed the newlines from the JSON in the operations file. I'm looking at the code and the documentation to see what I can do about the issues. I think the first step will be to update the documentation to be honest. We can then look at the code to see if anything can be done to support other options for passing parameter values/data to the API |
I've updated the HTTP API documentation at https://github.com/OpenRefine/OpenRefine/wiki/OpenRefine-API If there are further issues with the documentation, or you would like the HTTP API to work differently to how it works currently, please open a new issue for each problem / request (and of course, feel free to add to the documentation where you can improve it directly) |
Running this command
The test.json file has the following
I get this exception which seems to complaint about the formatting of the content in the test.json file. However that content was taken directly from the OpenRefine UI
Also, note I passed the
project_id
as a query string param while the documentation says it should be a form param. Passing as a form param, I get another exception complaining for missing param.The text was updated successfully, but these errors were encountered: