restclient.el icon indicating copy to clipboard operation
restclient.el copied to clipboard

POST to https endpoint fails?

Open bitops opened this issue 10 years ago • 13 comments
trafficstars

Hello, I am trying to POST JSON to an API I'm writing. Making curl requests works fine but I'm getting these errors from restclient.el

Request

POST https://www.example.com/
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "secretP@55word"
}

Messages buffer output

Contacting host: **API URL**:443
Opening TLS connection to `**API URL**'...
Opening TLS connection with `gnutls-cli --insecure -p 443 **API URL**'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 **API URL** --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect **API URL**:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `**API URL**'...failed
url-http: Could not create connection to **API URL**:443

gnutls-cli version

$ /usr/local/bin/gnutls-cli --version
gnutls-cli 3.3.9

bitops avatar Apr 02 '15 16:04 bitops

cc @pashky

bitops avatar Apr 06 '15 18:04 bitops

...and your point is? It works for me and, I guess, many others. I've never tried it with external command though, I always compile gnutls in and don't see why you wouldn't. Or at least add /usr/local/bin to $PATH.

pashky avatar Apr 07 '15 13:04 pashky

@pashky just wondering if you had seen that error before. I'll give the /usr/local/bin thing a shot.

I use the builds from Emacs for Mac OS X which I guess don't have gnutls compiled in by default. Maybe that'll help me out.

bitops avatar Apr 07 '15 21:04 bitops

@bitops highly recommend brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick vs. Emacs for OSX.

You can choose to ommit the --HEAD --user-git-head stuff but I don't and it has historically been stable for me.

localredhead avatar Apr 07 '15 22:04 localredhead

@localredhead is it just the same as Emacs for OSX in terms of the UI? I'm attached to my current setup. :smile_cat:

bitops avatar Apr 07 '15 23:04 bitops

@bitops I cannot say for certain without trying.

To my knowledge emacs in GUI mode will be the same because EmacsForOSX is supposed to be a VANILLA install of emacs without any extra bells and whistles.

You should feel free to use the brew version - which has the benefit of being built for your machine when you brew install it. Another added benefit of this is that you get a proper version of emacs to run in the terminal and also in GUI. The caveat is you have to unlink the OS supplied version of emacs (which is OOOOOLD). Personally I just delete the OSX supplied version and move the /bin out of the way. Then when I brew install emacs with the command I give you it will build, install, and Link emacs appropriately.

Let me know if you have trouble with it. [email protected] - I can answer questions you might have.

localredhead avatar Apr 08 '15 01:04 localredhead

@localredhead thank you! I'll let you know if I have trouble.

bitops avatar Apr 08 '15 16:04 bitops

I am also hitting this same error. I've tried brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick to no avail. When I copy as curl my request works.

Any known steps to debug this issue?

danrasmuson avatar Jan 09 '18 00:01 danrasmuson

I'm having the same problem, too. I've been using this module for months... and then, all the sudden, it stopped working. I'm guessing a recent commit to trunk broke it.

kgrimes2 avatar Jan 11 '18 05:01 kgrimes2

Guys, would learn how to unix already or switch to Atom, please? Or Notepad++ even, if you can't set PATH properly.

pashky avatar Jan 11 '18 10:01 pashky

I hear good things about Notepad++

danrasmuson avatar Jan 12 '18 08:01 danrasmuson

@pashky I don't understand–what do you mean "learn how to unix already"? The error is extremely unhelpful and doesn't even remotely point me in the right debugging direction.

kgrimes2 avatar Jan 13 '18 00:01 kgrimes2

Try to eval (url-retrieve-synchronously "https://www.example.com").

If it fails, it is not problem of restclient.el, but probably environment problem.

exec-path-from-shell might help if you use macOS.

iquiw avatar Jan 13 '18 02:01 iquiw