Skip to main content

API Explorer

API Explorer UI tutorials

Abstract

API Explorer UI tutorials

These tutorials describe how to use the API Explorer web utility, which makes it easy to create and run FairCom’s jsonActions.

All FairCom JSON APIs can be tested using API Explorer. The JSON APIs include JSON Admin API, JSON Hub API, and JSON MQ API

API_explorer_overview.png
  1. Start the FairCom Edge browser-based tools (https://localhost:8443/) menu.

    Note

    See Manage certificate warnings for issues accessing the tools.

    FairComEdgeHome.png
  2. Access the API Explorer with either Data Explorer or MQ Explorer:

    • In the Data Explorer, through the API Explorer tab.

      APIExplorerTab.png
    • In the MQ Explorer, through the Control menu (ConrtolMenuIcon.png).

      APIExplorerControlMenu.png

There are three ways you can connect to a database with a new session.

Figure 1. Connect to Server and Database window
Connect to Server and Database window


Connect to a database with no prior connection

  1. Select the database you wish to connect to in the Server navigation window.

  2. Click Yes in the New Session pop-up window.

    NewSessionPopup.png
  3. Click Connect to Server in the Connect to Server and Database window (see Figure 1, “Connect to Server and Database window).

  4. Observe your database in the new session.

Right-click on a database you have a current connection to

  1. Right-click the database you wish to connect to in the Server navigation window and click Connect (Connect.png).

    ServerNavigationDropdown.png
  2. Click Connect to Server in the Connect to Server and Database window (see Figure 1, “Connect to Server and Database window).

  3. Observe the connection to the database you selected in a new session (a new browser tab).

Select a database that you have a current connection to

  1. Select the database you wish to connect to in the Server navigation window.

  2. Select Connect (Connect.png) from the Menu dropdown menu.

    MenuDropdown.png
  3. Click Connect to Server in the Connect to Server and Database window (see Figure 1, “Connect to Server and Database window).

  4. Observe the connection to the database you selected in a new session (a new browser tab).

  1. Click Select API to open the API dropdown menu.

    SelectAPIdropdown.png
  2. Select from the list of available APIs:

    • JSON Admin API

    • JSON DB API

    • JSON MQ API

    • JSON Hub API

  3. Observe the selected API's actions, templates, and properties.

Once an API is selected, the JSON Actions dropdown menu contains the actions available within that API.

  1. Click the JSON Actions dropdown menu.

    JSONActionsDropdown.png
  2. Select an action — for example, createTable.

    Note

    Some actions require preliminary actions to be run first — for example, before selecting and running deleteTable you must first have selected and run createTable.

  3. Observe the JSON request example in the API Request editor.

FairCom provides online documentation for each action.

  1. Click the action's Show help for selected action icon (InfoIcon.png) for available online documentation.

    InfoIconLocation.png
  2. Observe the documentation in a new tab.

When you select an action from the JSON Actions dropdown menu, API Explorer loads an example JSON request into the API Request editor.

  1. If preferred, select from pre-formatted templates in the Templates dropdown menu.

    Templatesdropdown.png
  2. In the API Request editor, edit the existing example JSON.

  3. Alternatively, paste or type in your own examples.

Figure 2. Upload JSON example from a disk
Upload JSON example from a disk


  1. Click the Upload set of JSON files icon (UploadSetOfJSONFilesIcon.png).

  2. Select the JSON example file.

  3. Click Open.

Figure 3. Save a JSON example to a disk
Save a JSON example to a disk


  1. Click the Export JSON icon (ExportJSONIcon.png).

  2. Observe the download in the download bar.

  1. To view the Property defaults panel, click the Show property defaults icon (ShowPropertyDefaultsIcon.png).

  2. Observe the Property Defaults panel.

    PropertyDefaultsPanel.png
  3. To hide the Property Defaults panel, click the Show property defaults icon (ShowPropertyDefaultsIcon.png) or the Close Panel icon (ClosePanelIcon.png).

  4. Observe the API Explorer without the Property Defaults panel.

The Property Defaults panel allows you to create a list of default values that apply to the JSON example displayed in the API Request editor.

Figure 4. Property Defaults panel with an added default
Property Defaults panel with an added default


  1. Click the Show property defaults icon (ShowPropertyDefaultsIcon.png) to view the Property Defaults panel.

    PropertyDefaultsPanel.png
  2. Click the Add Default button (AddDefaultButton.png) to add a property to the list.

  3. Edit the Property Path to match the path that identifies the property in the JSON — for example, params.databaseName (see Figure 4, “Property Defaults panel with an added default).

  4. Edit the Default Value to your desired default value — for example, edit the params.databaseName default value to test_db.

  5. Click Update to save your changes.

  6. Click the Apply defaults to JSON request defaults to JSON request icon (ApplyDefaultsToJSONRequestIcon.png) to apply the new default values.

  7. Alternatively, click the Remove icon (RemoveIcon.png) next to the default property to remove it.

  8. To hide the Property Defaults panel, click the Show property defaults icon (ShowPropertyDefaultsIcon.png) or the Close Panel icon (ClosePanelIcon.png).

  1. To view the Action Properties panel, click the property Show all action properties icon (ShowAllActionPropertiesIcon.png).

  2. Observe the Action Properties panel.

    ActionProperties.png
  3. To hide the Action Properties panel, click the property Show all action properties icon (ShowAllActionPropertiesIcon.png) or the Close Panel icon (ClosePanelIcon.png).

  4. Observe the API Explorer without the Action Properties panel.

The Action Properties panel is a list of available properties for the selected action.

Figure 5. Action Properties panel
Action Properties panel


  1. Use the Add property to request body icon (AddPropertytoRequestBodyIcon.png) to insert a property into the API Request example.

  2. Use the Add property to Property Defaults panel icon (AddPropertytoPropertyDefaultspanelIcon.png) to add a property to the Property Defaults list.

  3. Use the Show property definition icon (ShowPropertyDefinitionIcon.png) to display any information about a property.

All API actions (except createSession and pingSession) require a valid authToken property value.

  1. Click the Apply defaults to JSON request defaults to JSON request icon (ApplyDefaultsToJSONRequestIcon.png).

  2. Observe your supplied, valid authToken property value.

    Note

    When API Explorer first runs, it automatically runs the createSession action, creating a server session and returning a valid authToken value. API Explorer uses this value when you click the Apply defaults to JSON request defaults to JSON request icon and then load examples from action templates.

  3. If you wish to use a different authToken than the one supplied at createSession, use the Property Defaults feature to set the authToken to a different authorization code.

When an authToken is invalid the server returns one of the following errors:
  • Error 60025

    "errorCode": 60025,
    "errorMessage": "Invalid parameter - Missing authToken parameter in the request. The only actions that do not require authToken are createSession and pingSession in the admin API."
  • Error 60031

    "errorCode": 60031,
    "errorMessage": "Not possible to find valid session for the provided token."
    
Figure 6. Run an action
Run an action


  1. Click the Send Request icon (Runbutton.png) to run the current action with the properties in the API Request editor (see Figure 6, “Run an action.

    Tip

    Keyboard shortcuts:
    • For Windows use CTRL+ENTER.

    • For Linux use COMMAND+ENTER.

  2. Observe the response and ensure the action completed successfully.

    Note

    "errorCode" with a value of 0 indicates success. "errorCode" with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.

  3. Check the Accumulate Results? checkbox to accumulate the results each time the API Request editor example is run.

    Note

    When the Accumulate Results? checkbox is left unchecked the API Explorer clears the results from the API Response viewer each time the request example is run.

  4. Click the Download results icon (DownloadResults.png) to download the results to a disk.

  5. Click the Clear results icon (ClearResults.png) to clear the API Response viewer.