Creating the First Query
Queries define the way data is fetched from one of your datasources and made available within Confluence. Use the tabs on top to jump to the overview of "Queries". Again, you will find an empty list. Click "Add query" and set up your first query.
The most important fields, that we will use now, are:
The datasource used. Depending on the type of the datasource, the form will adjust as an SQL statement needs different parameters than a REST call.
The name of the query. This name can be changed later.
The statement, i.e. the SQL statement itself. In our example, we will retrieve all countries on the continent 'Europe'.
As you can see, there are more features available which are described in the documentation. For now, simply click "Ok" to save.
Let’s test, if our query works: Press the “Test Query“-Button. The dialog preview should pop up:
Looks like this is working - your first query is now ready to go!
Use the PocketQuery Macro
Go to any Confluence page in any space you like and edit it. Add the PocketQuery Macro to it, either by clicking the plus icon from the toolbar and selecting "Other macros" or by typing an opening curly bracket followed by "pocketquery".
A dialog opens that allows you to set the macro parameters. From the dropdown "Query name" select the query we just created in the administration. You can use the preview feature if you like, or simply add the macro right away by clicking "Save".
Save the Confluence page and have a look at the big table the PocketQueryMacro displays. This data comes straight from the "world" database!
Let’s continue with “Adding Parameters to Your Query “