Open chabotsi opened 7 years ago
Hi,
I took a look and in fact, there is confusion in controllers between "export" feature and "api" feature. As they use the same bundle, the allowed formats for export are also allowed for api methods, but other methods than export force JSON Response. But just replace the "response" method is not enough because there is no built-in serializer for txt, pdf, epub and mobi. There is two solutions :
In my opinion, it would be better to do the first solution, as there is already an "export all entries" feature in app.
What do you think guys ? :)
Fix response method to return XML in addition to JSON (as it is configured in config.yml) then update the documentation to reflect the configuration.
Could you elaborate?
yep,
so the idea would be to change the sendResponse
method in src/Wallabag/ApiBundle/Controller/EntryRestController.php
to use the view layer of FOSRestBundle.
About the documentation part, after quick check, available formats are not in methods documentation, but in the self-generated documentation (I think it's the tricky part to fix).
Is it clearer ? :) (or directly a PR would it be ?)
Note: current config for /api/
methods :
- { path: "^/api", priorities: ['json', 'xml'], fallback_format: json, prefer_extension: false }
Give it a try. I fixed api export here https://github.com/wallabag/wallabag/pull/2453 if this could help
I ran into this problem now. I want to automate downloading the epub or mobi. Is there a way to use /export/
with a token?
Is this the same case with /api/annotations? I am not able to produce a txt or csv output with something like this. I am getting back a json response.
http GET https://app.wallabag.it/api/annotations/{entry}.txt
Issue details
I wanted to use /api/entries.epub to export all my articles into a single epub file, but I obtained a json file whatever the format I asked.
According to the api documentation, /api/entries.{_format} should export in the given {_format} ( xm|json|txt|csv|pdf|epub|mobi) and not only json.
Steps to reproduce/test case
Here is the python script I used : https://chabotsi.fr/paste/?52cb8ab63a07dbbd#E+YMTgL5VTWTcez23Cmk0xVZvDBH/vzAa0LN5O/mDaY=