• Stars
    star
    208
  • Rank 188,717 (Top 4 %)
  • Language
    Emacs Lisp
  • Created almost 9 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An org-mode extension to restclient.el

ob-restclient.el

https://melpa.org/packages/ob-restclient-badge.svg

An extension to restclient.el for emacs that provides org-babel support.

To get started, install ob-restclient.el and add (restclient . t) to org-babel-load-languages:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((restclient . t)))

You can then execute the query by pressing C-c C-c on the source-block header.

header arguments for :results raw|value|pure|table will make a clean result containing solely the response, and :jq PATTERN will post-process the response by passing the value to jq, provided the binary exists at a location specified by org-babel-restclient--jq-path

#+BEGIN_SRC restclient
  GET http://example.com
#+END_SRC

#+RESULTS:
#+BEGIN_SRC html
<!doctype html>
<html>
<head>
  ...
</head>
</html>
#+END_SRC

You can pass variables into the block using :var header arguments. For example:

#+name: example_host
#+BEGIN_SRC elisp
  "example.com"
#+END_SRC

#+BEGIN_SRC restclient :var host=example_host :var foo="example" :var bar=42
  GET http://:host?foo=:foo&bar=:bar
#+END_SRC

See restclient.el for documentation and examples of usage.

Author

Alf Lervåg