5 ms·
Dealing with APIs, JSON and databases in org-mode
- hprotagonist 5y agothat seems a little more ergonomic at first glance than ob-restclient https://github.com/alf/ob-restclient.el https://github.com/alf/ob-restclient.el
- newusertoday 5y agothat was awesome. Do you know if it is possible to do syntax highligting in org mode between begin_src..end_src?
- buscoquadnary 5y agoIn doom emacs for me it does it by default if I had the src language so #+BEGIN_SRC json #+END_SRC Or #+BEGIN_SRC ruby #+END_SRC And I have a pretty vanilla doom emacs config.
- alex_smart 5y agoPretty sure that it's OOTB for completely vanilla Emacs.
- kreetx 5y agoIt is! Just specify the language after #+begin_src.
- zelphirkalt 5y agoYes, definitely. For all languages, for which you have a major mode installed. I think you need to look for "fontify source block emacs org mode" or so. Basically org hands highlighting off to those major modes, if I understand it correctly. Edit: Found it: https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html https://orgmode.org/worg/org-contrib/babel/examples/fontify-...
- piranha 5y agoJust in case you like this, but don't use org-mode, there is https://github.com/pashky/restclient.el https://github.com/pashky/restclient.el
- nanna 5y agoIn the words of Emacs Rocks!, 'a sparkling gem in user interface design, restclient-mode': http://emacsrocks.com/e15.html http://emacsrocks.com/e15.html
- joe8756438 5y agorestclient.el is also great because there's a similar package that works for vscode so for team members not on emacs you still get interop.
- kreetx 5y agoI've mostly used bash source blocks (with curl, jq, awk etc) for this. OPs way is definitely more aesthetic but a bash cli seems more flexible. Other than that, org-mode can also be your postman, but mixes well with your other notes. :)
- xtiansimon 5y agoI’m a complete noob at api work. I could use the 20,000ft view. What are these components for a bash solution you describe? I know curl makes http requests, but what is this workflow? I’m frequently using tmux, vim and zsh, so your comment grabbed my attention, and I need to do this for a project that has something called OData.
- michael-ax 5y agohe's likely doing the same thing with a few more lines of boilerplate than the OP with his admirably (kicks me in the behind) well specialized 'dsl' extensions. it's got nothing to do with tmux/vim/zsh, instead, it's an example of emacs's org's polylingualness showing just how sweet it can be when extended to support one of 'any' console tool you care about, in whatever workflow. you make these documents with notes, and run them or any part of them from org or tangled/driven from the commandline. its nice. plus the editor ...
- kreetx 5y agoExactly. So instead of the first example I'd have the following in some .org file, where C-c C-c on the bash block generates the result block: #+begin_src bash :results verbatim curl https://jsonplaceholder.typicode.com/todos/1 #+end_src #+RESULTS: : { : "userId": 1, : "id": 1, : "title": "delectus aut autem", : "completed": false : }
- marco_craveiro 5y agoGreat post, with lots of interesting things to improve my workflow! My progression has been 1) rest client 2) org-mode with blocks 3) verb-mode. However, I think most of what is mentioned can be applied equally to verb-mode, which sort of a DSL built on top of org-mode. [1] https://github.com/federicotdn/verb https://github.com/federicotdn/verb