0

I'm a beginner org-mode user. Is there a way to remove baseUrl being duplicated in each block like the following one?

#+NAME: request-something
#+HEADER: :var baseUrl="http://localhost:3000"
#+HEADER: :var email="foo@bar.com"
#+BEGIN_SRC http 
POST ${baseUrl}/api/foo
Content-Type: application/json

{
  "email": "${email}",
}
#+END_SRC

I've tried to extract it as

#+NAME: baseUrl
| http://localhost:3000 |

but keep getting "cannot resolve a template to values" ob-http error trying to read it in src block

1

OK the following solution did the trick:

  1. add
#+PROPERTY: header-args :var baseUrl="http://localhost:3000"
  1. restart org-mode

Ctrlcc in my case while staying on that PROPERTY line

Messages buffer would the following lines as a result:

>org-mode restarted
>Local setup has been refreshed

Take a look at this related question if you want to know more How to specify default header arguments in orgmode code blocks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.