Closed ben-lavelle closed 2 years ago
@ben-lavelle Did you end up extracting the file from the location (container/host) or did you find a way to hook an endpoint that serves the simple JSON?
I found commit 01407377ff7cfef52132fa979b212e4e5010614d which seems to implement the requested API with the url "simple-json". It was from Dec. 21, so I supposed that the docker image axarev/parsr:master
would contain it. Unfortunately, when I execute curl -X GET http://localhost:3001/api/v1/simple-json/51966c63fe06c7472add19bbbdb6c5
, it still get:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/v1/simple-json/51966c63fe06c7472add19bbbdb6c5</pre>
</body>
</html>
I suppose that there is still missing bits to implement the feature? @agarwal-nitesh , you are the one who commited the change. Maybe have you insights about that ? (I have really no knowledge about JavaScript so I have difficulties pursuing the search).
Hi @kleag. I built using the docker-compose-build file and the API worked but some staged changes were not part of the above commit and are required. Here they are https://github.com/axa-group/Parsr/pull/593. My apologies.
Don't apologize @agarwal-nitesh . In the contrary, thanks a lot for your contribution and help! With your clone, I was able to build and use the docker composed images.
I had to copy ./docker/parsr-base/policy.xml
to the root of the project and to create a user with UID 1001 on my system (my user is 1000) to make it work.
I also had to add "simpleJson":true
in the config.json
file. It would be more coherent if it would be simple-json
as in the endpoint.
The status message should also contain an entry for the simple-json
result.
Maybe the two above points should be new issues in fact.
The endpoint has been added by @agarwal-nitesh on PR #593
Summary
The simpleJson output described in the docs looks to be a useful output in simple use-cases. However, it is not implemented in the python client, and doesn't appear to be implemented in the API (or is at least it beats me how to find it!).
I can't see any other issues or PRs that reference simpleJson; apologies if this is a duplicate (or straight-up wrong!)
Steps To Reproduce
This seems to me to be regardless of what config file and input file is used, so the Jupyter notebook example with
defaultConfig.json
is sufficient to demonstrate.Steps to reproduce the behaviour:
defaultConfig.json
or any config with simpleJson output requested and check other outputs are as expected.parsr.get_status()
and note that even if requested, the endpoint forsimpleJson
output is not listed in the response (example request hash):Find no such endpoint for
/api/v1/simplejson
or/api/v1/simple-json
,api/v1/simple/json
etc.See in the API logs that the simpleJson output was in fact produced, e.g.
but fails to be presented as a discoverable endpoint.
Expected behavior
An endpoint should be available for the useful simpleJson output. It'd also be nice to add a
get_simpleJson()
method to ParsrClient or addparsr.get_json([simple: bool=False])
option to the existing full JSON method.Actual behavior
No endpoint found at some sensible addresses; no way that was apparent to me of accessing the simpleJSON output. Correspondingly no way to access simpleJSON from the py client.
Environment
Parsr==v1.2.0, parsr-client==3.0.0
Docker Engine - Community v19.03.5
Additional context
I would be happy to put together the py client implementation as a PR if you think it is a useful feature, but my knowledge of the API in js is absolutely minimal so I'm not sure I can fix this part. For the same reason sorry if this is a daft issue and I'm missing something obvious!