Node-RED is a useful tool for accessing remote REST API's and also for creating them.
In either case, it can be useful to be able to test the API's separate to Node-RED.
Here are my chosen tools - both use the Microsoft VSCode free code editor as the host for convenience.
-
The REST Notebook extension: Notebooks, Visual Studio Code style
This is a fairly new extension using the new Notebook API now built into VSCode (originally developed to allow Jupyter Notebooks to work natively, a REALLY useful feature in its own right). This extension is developed by one of the core VSCode developers.
-
The REST Client extension: REST Client - Visual Studio Marketplace
I find this really useful as you can easily create a script file for testing multiple API's very easily. As in this example for testing the API's provided by uibuilder:
// Test uibuilder v3 admin API routes
//
// Using REST Client extension https://github.com/Huachao/vscode-restclient#rest-client
// File variables
@hostname = localhost
@port = 1880
@host = {{hostname}}:{{port}}
@redAdminPath = red
@uibPath = uibuilder
@uibAdminPath = admin
@contentType = application/json
@createdAt = {{$datetime iso8601}}
# Valid uibuilder instance URL
@url = test1
# @name Sample-Get
# Get something and return it
GET http://{{host}}/{{redAdminPath}}/{{uibPath}}/{{uibAdminPath}}/{{url}}?ping=pong
content-type: {{contentType}}
{
"name": "sample GET",
"time": "{{createdAt}}"
}
###
# @name Sample-Put
# Write file contents
PUT http://{{host}}/{{redAdminPath}}{{uibAdminPath}}/{{url}}
content-type: {{contentType}}
{
"name": "sample PUT",
"time": "{{createdAt}}"
}
###
# @name Sample-Post
# Create a new folder or file
POST http://{{host}}/{{redAdminPath}}{{uibAdminPath}}/{{url}}
content-type: {{contentType}}
{
"name": "sample DELETE",
"time": "{{createdAt}}"
}
###
# @name Sample-Delete
# Delete a folder or a file
DELETE http://{{host}}/{{redAdminPath}}{{uibAdminPath}}/{{url}}
content-type: {{contentType}}
{
"name": "sample DELETE",
"time": "{{createdAt}}"
}
###
# @name Instance-Info
# Returns an HTML page of info for the current instance of uibuilder
GET http://{{host}}/{{redAdminPath}}{{uibAdminPath}}/instance/{{url}}
content-type: {{contentType}}
{
"cmd": "showinstancesettings",
"time": "{{createdAt}}"
}
###
# @name List-All-User-Urls
# Returns json list of all ExpressJS routes on the user app
GET http://{{host}}/{{redAdminPath}}/{{uibPath}}/{{uibAdminPath}}/{{url}}
content-type: {{contentType}}
{
"cmd": "listurls",
"time": "{{createdAt}}"
}
// NOTES:
// - can send a file: `< filename.json` or (for processing variables): `<@ filename.json`
// - ExpressJS supported methods are here: https://expressjs.com/en/4x/api.html#app.METHOD