How to use the Insomnia CDRouter Web API workspace
Insomnia is a free, cross-platform graphical REST API client which is a great tool for learning the CDRouter Web API. QA Cafe has created an Insomnia workspace that can be imported which contains examples for every CDRouter Web API endpoint. The Insomnia workspace is a great tool to augment our existing CDRouter Web API documentation for learning the CDRouter Web API.
To begin, install Insomnia by following the directions on the Insomnia
website. Next, save
this
exported CDRouter Web API workspace
to your machine. Import the workspace into Insomnia by selecting
Import/Export
from the purple pull-down menu in the top-left. In
the dialog box that appears, select Import Data
and navigate to the
cdrouter-web-api.json
file that you previously downloaded. Press
Ok
on the Import Succeeded
dialog box that should appear after a
few seconds. Next, switch to the new CDRouter Web API workspace by
selecting To CDRouter Web API
under SWITCH WORKSPACE
from the
purple pull-down menu.
You should now see a list of API endpoints organized by resource type
in the left-hand sidebar. The last thing you need to do is configure
Insomnia with the location and credentials it will use when sending
API requests to your CDRouter system. Select Manage Environments
from the No Environment
pull-down menu below the purple pull-down
menu in the top-left. In the dialog box which appears, edit the
base
and token
fields with the URL to your CDRouter system and a
valid API token for your system. You can ignore the token
field if
you
have
Automatic Login enabled.
Please note that if you specify base
as an https
URL and are using
a self-signed certificate (the default), you will need to uncheck
Validate SSL Certificates
in the App Settings
dialog box from the
purple pull-down menu. Once you have set base
and token
appropriately, you can close the Manage Environments
dialog box. To
test that Insomnia is correctly configured, select the List configs
endpoint from the left-hand sidebar and press Send
. A green 200 OK
and a JSON response body should populate the right-hand sidebar.
Now that Insomnia is properly set up, feel free to experiment. You
can quickly search for API endpoints with the Filter
box underneath
the No Environment
pull-down in the top-left. Feel free to change
the URL, URL parameters, headers and request bodies of any of the API
endpoints and see how those changes affect CDRouter’s response. Some
endpoints have template parameters such as {{id}}
or {{name}}
in
their URL. These are configured by selecting Environment
from the
pull-down menu of the enclosing folder in the left-hand sidebar.
These template parameters make it easy to work with the same resource
when experimenting with different endpoints by setting the template
parameter to that resource’s ID or name.
If you want to clear any customizations you have made to the
workspace, simply delete the CDRouter Web API workspace and import it
again. Delete the workspace by selecting Workspace Settings
from
the purple pull-down menu and then pressing Delete Workspace
twice in the dialog box that appears. Once the workspace is
deleted, simply import it again by following the above instructions.
Please note you will need to configure your base
and token
environment settings again.
Please see the Insomnia documentation for more help on using Insomnia.