These tutorials show how to interact with the FairCom Edge database server using the FairCom API Explorer web utility to pull, store, view, and use data from MQTT messages.
- Ensure the FairCom server is installed and running.
- Confirm server access by running the FairCom API Explorer. The typical URL is
https://localhost:8443/.
Create a session
- Start the FairCom browser-based tools.
- Navigate to the Code section from the sidebar menu.

Create the "MyTopicTable" integration table adding a transform to extract captured MQTT JSON data into table fields
This procedure creates a transform that will convert the JSON-based data from the "MyTopicTable" Integration Table into fields in the same table.
The Integration Table automatically creates the source_payload, ts_index and error fields. The jsonToTableFields transform extracts values from source_payload (which stores the MQTT JSON data) and stores them in the property_1 and property_2 fields defined in the request.
- Start the FairCom browser-based tools.
- Navigate to the Code section from the sidebar menu.
- Select the Hub API from the Select API dropdown menu.
- Select
createIntegrationTablefrom the JSON Actions dropdown menu. - Replace the JSON in the API Request editor with the following JSON:
6. Click Execute ({ "api": "hub", "action": "createIntegrationTable", "params": { "tableName": "MyTopicTable", "fields": [ { "propertyPath": "property_1", "name": "property_1", "type": "varchar", "length": 300 }, { "propertyPath": "property_2", "name": "property_2", "type": "float" } ], "transformSteps": [ { "transformStepMethod": "jsonToTableFields", "mapOfPropertiesToFields": [ { "fieldName": "property_1", "recordPath": "source_payload.property_1" }, { "fieldName": "property_2", "recordPath": "source_payload.property_2" } ] } ] }, "authToken": "replaceWithAuthTokenFromCreateSession" }
) to issue the JSON-based command.
7. Observe the response and ensure the action is completed successfully.
"errorCode"with a value of0indicates success."errorCode"with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.
Configure an MQTT topic to implement the transform
- Select MQ API from the Select API dropdown menu.
- Select
configureTopicfrom the JSON Actions dropdown menu. - Replace the JSON in the API Request editor with the following JSON:
{ "api": "mq", "action": "configureTopic", "params": { "topic": "MyTopic", "databaseName": "faircom", "tableName": "MyTopicTable" }, "authToken": "replaceWithAuthTokenFromCreateSession" } - Click Execute (
) to issue the JSON-based command.
5. Observe the response and ensure the action is completed successfully.
"errorCode"with a value of0indicates success."errorCode"with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.
Access MQTT management
- Start the FairCom Browser-Based tools.
- Select MQ.
Publish JSON data to an MQTT topic
Now that the OPC UA data is flowing into a table as JSON and being transformed into discrete fields in the same table, the data can be forwarded out over MQTT.
- Navigate to Messages:
- Click ‘Add’ in the Subscriptions section;
- Choose the
"MyTopic"topic; - Click Subscribe (
);
4. Navigate to Publish:

5. Enter "MyTopic" in the Topic text box.
6. In the Message text box enter:
{"property_1":"Stuff goes here","property_2":39}
7. Click Publish Message (
).
8. Go back to “Messages” and observe that your message was published successfully.
View transformed data
- In the FairCom Edge, navigate to IoT > Tables. Select "MyTopicTable" from the Table Name section;
- Click the Records tab.
- Observe a new row that contains the published values of the second message in the Property1 and Property2 fields.
Query captured MQTT data using SQL
- In FairCom Edge, navigate to Data > SQL > Queries;
- In the Enter SELECT query code box, execute the following SQL query against the data:
select * from mytopictable where property_2 > 30; - Observe data in the Results window.
Query captured MQTT data using the JSON DB API
- Select DB API from the JSON API dropdown menu.
- Select
"getRecordsByIndex"from the JSON Actions dropdown menu. - Change the
"tableName"property value from"athlete"to"MyTopicTable". - Change the
"indexName"property value from"id_pk"to"ts_index". - Click Execute (
). - Observe the records from the table returning as JSON in the API Response.
"errorCode"with a value of0indicates success."errorCode"with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.