Scenario:
- API authorization is often needed to allow API interactions on GadgetKeeper
- API Keys enable this authorization on a command line tool, such as cURL or a REST API
- API Keys are 32-bit alphanumeric strings similar to Thing Ids, Property Ids, etc.
- An API Key can be copied and pasted into an API command as needed
Prerequisites:
- API authorization allows access to properties, methods, events, etc. of selected things
- Access permissions include Read, Write, and Publish Event
- An API Key can be used to grant the selected permissions for either one thing, a group of things, or all things
- Permissions and things are selectable when creating the API Key
Steps:
1. Create API Key
- Click "API Keys" in the main menu to open a tab with the current list of API keys
- Click "+" to open "Create API Key" dialog
- Set a name for the API Key
- A randomly generated character string is shown for "API Key". This string can be changed if needed by clicking "Regenerate"
- Check the "All things" check-box to grant access to all things, or leave unchecked restrict access to particular things only
- If "All things" is unchecked, then click in "Selected things" to open a drop-down menu. Select things to grant access to in this menu
- Select one or more permission types for the API key (Read, Write, and/or Publish event). Checking "All" will automatically select all three
- Click "Save" to save the new API key
When selecting things to be accessed by the API key in step 6, any number of things can be selecting by checking boxes next to the thing's name
Things can also be selected by entering in the thing's ID number instead of its name
Thing names and/or thing ID's are separated by commas in the thing list
2. Copy API Key
- In the "API Keys" tab, select the API Key to be copied by clicking the gold key next to its name
-
Double click on the "API Key" value in the "Details" panel and copy it
The "API Key" value can now be pasted in any API command (REST API, curl, etc.) that requires API authorization to access procedures and/or properties of a thing
Note: Any API key can be disabled by clicking the "Disable" button while viewing its details. Its "Active" status will then be changed from "true" to "false". Clicking "Enable" will enable the API key again