Emacs as REST client
May 29 2017103 words, ~1 min. read
emacs, REST
Emacs could be an effective REST client, using restclient-mode.
Steps
- Install
restclient, using emacs package manager - Enable
restclient, usingM-x restclient-mode - Type REST API, HTTP header and body, as appropriate
- Execute by pressing
C-c C-c
Note
- You may format JSON requests, by selecting the JSON text, typing and executing
M-x json-pretty-print - You may use variables of the form
:variable #is used for comments and a comment separates an API from others
Example
:host = localhost
:port = 8443
:api = :host::port
# create a contact
POST https://:api/v1/contacts
Content-Type: application/json
Authorization: Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
{
"name": "Bala"
}
# list all contacts
GET https://:api/v1/contacts