The Perfion API queries are an important tool for Perfion users. It is used for testing views, filters and the ecommerce API, in setting up dashboards and used when working with search features.
Its use, however, requires in-depth knowledge of Perfion which may deter users who just want to implement searches, dashboards or filters. The API Query Builder has been developed to make basic querying easier, while still allowing advanced users to build advanced queries.
If you have the required permissions, you can start the Query Builder from the Admin menu.
This will open the query editor which has two options:
- Simple mode and
- Advanced mode.
Simple mode
The following screenshot shows the structure of the simple query analyzer.
The three main sections of the page are described below.
The Select section
This section has two columns. One for features on the left, one for views on the right. You can select any feature in Perfion. By default, when opening an empty query, the feature selector shows the value "All" and the view dropdown is set to "Item". Once you have selected a feature, click the dropdown on the right to select the corresponding view. If a "From" feature has been selected, the selector shows views from that feature, otherwise, only standard views are available.
If a view has been selected, the feature selector turns into a simple dropdown containing two options: "All" and "All with remotes". In the query these are inserted as "*" and "**", respectively.
Click Add feature to create a new row.
The From section
When you open an empty query, this section shows the base feature with the id 100. Clicking into it opens a feature selector with all selectable features.
The Where section
This is the section to set your conditions. It has three columns: "Feature", "Operator" and "Value". The feature selector can select any feature in Perfion. The operator dropdown offers the standard operators as in the filter editor. The value is a simple text field. When opening the editor on an empty query, the default settings are:
- Feature: the feature with id 102
- Operator: "="
- Value: "DUMMY"
Controls
You can use the language selector in the top right corner of the modal to select the languages to be included in the query. By default, your data language is selected.
Click the Copy query button to put the query you have configured on the clipboard in XML form.
Click the Test query button to execute your query and open the results in the Simple query results modal.
The Go to advanced query button will switch to Advanced mode (see the next section).
The test results
As mentioned above, the test results are displayed in a new, read-only, modal called Simple query results.
If you have created an update, insert or delete query, you will be prompted for confirmation: "Are you sure you want to execute the insert/delete/update query"? If you confirm, the modal will show "X items updated/deleted".
You can save the result in XML or JSON by clicking the respective buttons at the bottom of the modal.
Advanced mode
The Advanced query analyzer modal is like a text editor. It has two dropdowns: one to select the format (XML or JSON), the other to pick a snippet / template. Selecting one of the snippets / templates inserts it in the text field in the cursor's position.
Click Test query to open the query results modal.
The Open simple view button will switch to Simple mode (discussed in the previous section).
Comments
0 comments
Please sign in to leave a comment.