Closed LaQuay closed 5 years ago
Thanks for your efforts to improve documentation!
Does that GET request really work for you? I've tried it with our simple
example:
$ curl -ig 'localhost:5000/people?where={"lastname":"Cleveland"}'
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 795
X-Total-Count: 2
Cache-Control: max-age=10,must-revalidate
Expires: Tue, 20 Nov 2018 04:40:35 GMT
Last-Modified: Tue, 20 Nov 2018 04:33:13 GMT
Server: Eve/0.7.10 Werkzeug/0.11.15 Python/3.6.6
Date: Tue, 20 Nov 2018 04:40:25 GMT
{"_items": [{"fullname": "Grover Cleveland", "id": 25, "firstname": "Grover", "lastname": "Cleveland", "_updated": "Tue, 20 Nov 2018 04:33:13 GMT", "_created": "Tue, 20 Nov 2018 04:33:13 GMT", "_etag": "c93ecec9bc5119db57406efffef020b13fa4095e", "_links": {"self": {"title": "person", "href": "people/25"}}}, {"fullname": "Grover Cleveland", "id": 27, "firstname": "Grover", "lastname": "Cleveland", "_updated": "Tue, 20 Nov 2018 04:33:13 GMT", "_created": "Tue, 20 Nov 2018 04:33:13 GMT", "_etag": "d6ad01878c77ce238396554a9953db10541fe923", "_links": {"self": {"title": "person", "href": "people/27"}}}], "_links": {"parent": {"title": "home", "href": "/"}, "self": {"title": "people", "href": "people?where={\"lastname\":\"Cleveland\"}"}}, "_meta": {"page": 1, "max_results": 25, "total": 2}}
$ curl -ig 'localhost:5000/people?where={"_created":"Tue, 20 Nov 2018 04:33:13 GMT"}'
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code: 400</p>
<p>Message: Bad request syntax ('GET /people?where={"_created":"Tue, 20 Nov 2018 04:33:13 GMT"} HTTP/1.1').</p>
<p>Error code explanation: HTTPStatus.BAD_REQUEST - Bad request syntax or unsupported method.</p>
</body>
</html>
The syntax you've used does not work for me, either.
Hi @dkellner, It seems to be a problem with the encoder. Your query works if first you encode it.
"/people?where=%7B%22_created%22:%22Tue,%2020%20Nov%202018%2004:33:13%20GMT%22%7D"
Also, adding --data-urlencode
to the curl query should work.
How can this tip be added to the documentation?
Ah well you'r right, this works:
curl -iG --data-urlencode where='_created> "Thu, 22 Nov 2018 09:00:00 GMT"' localhost:5000/people
Maybe we can add a section at the end of the tutorial "Tipps using cURL"?
Yes, I think so. I will propose it in a short term. A section below with this tip 👍
Merged after fixing some minor syntax issues (headings in tutorial.rst
) and line lengths. Thanks again!
Hi! It took me like 1h to see how to do a query of a datetime, so, here it is how to do it :+1: