Skip to content
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

curl request in features.rst not working #1298

Closed
beyondszine opened this issue Jul 15, 2019 · 1 comment · Fixed by #1312
Closed

curl request in features.rst not working #1298

beyondszine opened this issue Jul 15, 2019 · 1 comment · Fixed by #1312
Milestone

Comments

@beyondszine
Copy link

beyondszine commented Jul 15, 2019

At "https://github.com/pyeve/eve/blob/master/docs/features.rst#projections"
the following curl request is giving error because of the special symbols it has in curl request. It doesn't seem to be working with my curl tool.

○ → curl -i http://eve-demo.herokuapp.com/people?projection={"lastname": 1, "born": 1}
curl: (3) [globbing] unmatched brace in column 49
curl: (6) Could not resolve host: 1,
curl: (6) Could not resolve host: born
curl: (3) [globbing] unmatched close brace/bracket in column 2
○ → curl -V
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 

The special symbols seem to be replaced by standard clients like insomnia,postman,browsers.
I understand this has more association to curl tool itself, but since I found it being used in documentation for Eve & examples given so raising issue here.
Updating the documentation or specifying curl version & platform on which the commands worked(when written) can also help users while trying out with Eve.
Kindly let me know if I missed any part.

@beyondszine
Copy link
Author

It seems to be working with the -G & --data-urlencode params in curl.

curl -G -v "http://127.0.0.1:5000/people" --data-urlencode 'projection={"lastname":0}'

Example working:

○ → curl -G -v "http://eve-demo.herokuapp.com/people" --data-urlencode 'projection={"lastname":0}'
*   Trying 34.238.201.47...
* TCP_NODELAY set
* Connected to eve-demo.herokuapp.com (34.238.201.47) port 80 (#0)
> GET /people?projection=%7B%22lastname%22%3A0%7D HTTP/1.1
> Host: eve-demo.herokuapp.com
> User-Agent: curl/7.58.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Connection: keep-alive
< Content-Type: application/json
< Content-Length: 2251
< X-Total-Count: 5
< Cache-Control: max-age=20
< Expires: Mon, 15 Jul 2019 08:39:11 GMT
< Last-Modified: Mon, 08 Jul 2019 13:54:46 GMT
< Server: Eve/0.8 Werkzeug/0.14.1 Python/3.6.5
< Date: Mon, 15 Jul 2019 08:38:51 GMT
< Via: 1.1 vegur
< 
{"_items": [{"_id": "5d234b266538ae00040bf579", "firstname": "Julia", "role": ["copy"], "location": {"address": "98 Yatch Road", "city": "San Francisco"}, "born": "Sun, 20 Jul 1980 11:00:00 GMT", "_updated": "Mon, 08 Jul 2019 13:54:46 GMT", "_created": "Mon, 08 Jul 2019 13:54:46 GMT", "_etag": "ee5b39a22771125c356e478f698513bfdf9484a9", "_links": {"self": {"title": "person", "href": "people/5d234b266538ae00040bf579"}}}, {"_id": "5d234b266538ae00040bf57a", "firstname": "Anne", "role": ["contributor", "copy"], "location": {"address": "32 Joseph Street", "city": "Ashfield"}, "born": "Fri, 25 Sep 1970 10:00:00 GMT", "_updated": "Mon, 08 Jul 2019 13:54:46 GMT", "_created": "Mon, 08 Jul 2019 13:54:46 GMT", "_etag": "722190951f4e4e80c39d4d0b97fdba815e61c92f", "_links": {"self": {"title": "person", "href": "people/5d234b266538ae00040bf57a"}}}, {"_id": "5d234b266538ae00040bf576", "firstname": "John", "role": ["author"], "location": {"address": "422 South Gay Street", "city": "Auburn"}, "born": "Thu, 27 Aug 1970 14:37:13 GMT", "_updated": "Mon, 08 Jul 2019 13:54:46 GMT", "_created": "Mon, 08 Jul 2019 13:54:46 GMT", "_etag": "34080f3320bcc8e5f8cd4510c8b9cda952d7b923", "_links": {"self": {"title": "person", "href": "people/5d234b266538ae00040bf576"}}}, {"_id": "5d234b266538ae00040bf577", "firstname": "Serena", "role": ["author"], "location": {"address": "363 Brannan St", "city": "San Francisco"}, "born": "Wed, 25 Feb 1987 17:00:00 GMT", "_updated": "Mon, 08 Jul 2019 13:54:46 GMT", "_created": "Mon, 08 Jul 2019 13:54:46 GMT", "_etag": "5765a602ba22331cfe14902094ddd33582bcbbcd", "_links": {"self": {"title": "person", "href": "people/5d234b266538ae00040bf577"}}}, {"_id": "5d234b266538ae00040bf578", "firstname": "Mark", "role": ["copy", "author"], "location": {"address": "4925 Lacross Road", "city": "New York"}, "born": "Sat, 23 Feb 1985 12:00:00 GMT", "_updated": "Mon, 08 Jul 2019 13:54:46 GMT", "_created": "Mon, 08 Jul 2019 13:54:46 GMT", "_etag": "cb0d3fef4bacea422877d34495363bfc7a375aba", "_links": {"self": {"title": "person* Connection #0 to host eve-demo.herokuapp.com left intact
", "href": "people/5d234b266538ae00040bf578"}}}], "_links": {"parent": {"title": "home", "href": "/"}, "self": {"title": "people", "href": "people"}}, "_meta": {"page": 1, "max_results": 25, "total": 5}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants