I'm trying to construct an Org-based pipeline for some DevOps activities. Part of this requires making REST API calls and proceeding based on the results of those calls. I'm using ob-restclient
for making actual requests. One example would be:
#+name: applications
#+begin_src restclient :output value raw
GET :host/rest/deploy/application
Authorization: Basic :auth
Connection: keep-alive
Accept: application/json
Content-Type: application/json
#+end_src
:host
and :auth
are variables that I define elsewhere. Now, this works fine, except the RESULTS
section looks like this:
#+RESULTS: applications
#+BEGIN_SRC js
[
{
...
}
...
]
// <some response headers>
#+END_SRC
I want to be able to use the named result (applications
) as input variable to another code block, but the problem is, it's not a pure JSON string, but also contains the JS codeblock markers and the response headers. Any idea how I could get only the JSON part without parsing this string output? I suspect this might be configurable on restclient
's side, but I was unable to find a solution.
:output
AFAICT. An individual engine might define it but I don't see such inob-restclient.el
. Try:results value
.restclient
specific. I bypassed the problem by using a function to post-process the result (found one here).