Emacs has pretty good built-in support for these kinds of things, at least at the basic level of parsing requests and responses. Use url-retrieveor url-retrieve-synchronouslyto retrieve data from a remote service. As the names show, one is an asynchronous call that receives a callback, and the other is a blocking call that returns a buffer containing the response. Download them by including them (require 'url)in your Elisp file.
url- Elisp "URL", . GET, URL-, url-build-query-string . POST, PUT, DELETE url-request-data, url-request-method url-request-extra-headers. .
URL- HTTP , HTTP , , , . - () url-http-end-of-headers, , , .
json-read JSON json-array-type, json-object-type json-key-type JSON Lisp. (require 'json). XML- xml-parse-region libxml-xml-parse-region. , Emacs libxml, Elisp.
, JSON :
(url-retrieve
"http://example.com/api/some/request"
(lambda (events)
(goto-char url-http-end-of-headers)
(let ((json-object-type 'plist)
(json-key-type 'symbol)
(json-array-type 'vector))
(let ((result (json-read)))
;; Do something with RESULT here
))))
result, Lisp. plist-get, pcase cl-destructuring-bind . (require 'pcase), pcase, (require 'cl-lib), cl-destructuring-bind.