API Toolsλ︎
Astrocommunity proivdes plugins to support working with APIs and the JSON format
Included in Practicalli Astronvim Config
Practicalli Astronvim Config includes nvim-jqx and rest.nvim plugins
Inspect JSONλ︎
Browse and preview json files in neovim.
:JqxList
prettify JSON and start the inspector
JqxQuery
to run complex jq
commands
jq binary required
jq
binary should be available on the command line as nvim-jqx runs jq queries internally
Call APIsλ︎
Space r r to run an http request under the cursor from within an *.http
file.
A fast Neovim http client written in Lua, providing a curl wrapper.
http fileλ︎
Open a file with an *.http
extension
Write a call to an API, e.g. a call to a local server health care endpoint
A new window opens with the result of the API call
Result of API call with rest.nvim
GET http://localhost:8080/system-admin/status
Command :curl -sSL --compressed -X 'GET' --data-raw '' 'http://localhost:8080/system-admin/status'
#+END
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 66
Server: http-kit
Date: Mon, 10 Jul 2023 16:21:33 GMT
#+RESPONSE
{"application":"practicalli hole-in-one Service","status":"Alive"}
#+END
The Content-Type
can be explicitly set, especially useful when not using JSON