Next: eglot, Previous: GNU Emacs Common Lisp Emulation, Up: Emacs Lisp [Contents][Index]
“Easy HTTP request for Emacs Lisp”
(request "http://httpbin.org/get" :params '(("key" . "value") ("key2" . "value2")) :parser 'json-read :success (cl-function (lambda (&key data &allow-other-keys) (message "I sent: %S" (assoc-default 'args data)))))
(request "http://httpbin.org/post" :type "POST" :data '(("key" . "value") ("key2" . "value2")) ;; :data "key=value&key2=value2" ;; this is equivalent :parser 'json-read :success (cl-function (lambda (&key data &allow-other-keys) (message "I sent: %S" (assoc-default 'form data)))))
(request "http://httpbin.org/get" :sync t :complete (cl-function (lambda (&key response &allow-other-keys) (message "Done: %s" (request-response-status-code response)))))
(request "http://httpbin.org/get" :auth "digest" ;; or "basic", "anyauth", etc., which see curl(1) :complete (cl-function (lambda (&key response &allow-other-keys) (message "Done: %s" (request-response-status-code response)))))