Save Semantic Model Verified Queries
Resources
Below is an example of JSON structure which can be used as a reference for the queryJson parameter in the request body.
[
{
"question":"Rest API What is the total Amount for Country Germany?",
"visibility":{
"groups":[
],
"users":[
]
},
"isSampleQuestion":1,
"origin":0,
"context":"",
"id":"5D31F0D2-419B-8272-1E92-97333080E5D8?",
"sql":"SELECT SUM(`amount`) AS `total_amount` FROM `RestAPITest`.`RestApiTest` WHERE LOWER(`country`) = LOWER(germany)",
"action":"add"
}
]JSON Fields Description
Field | Type | Description | Possible Values | Example |
(root) | Array | Root JSON array containing verified query definitions. Each object represents a verified query for AI/conversational interfaces | Array of VerifiedQuery objects | [{...}] |
id | String | Unique identifier for this verified query. Required for UPDATE and DELETE actions. Auto-generated for new queries if not provided | GUID or empty for new queries | "query_17764122062715" |
question | String | The natural language question that users might ask. This is the query text that the AI will recognize and match against user questions. Must be unique within the semantic model | Any natural language question | "What are the total sales by region?" |
sql | String | The SQL query that should be executed when this question is asked. This is the verified/approved SQL that produces the correct answer for the question | Valid SQL query | "SELECT region, SUM(sales) FROM sales_fact GROUP BY region" |
context | String | Additional context or description for the query. Helps AI understand when to use this query and provides metadata for documentation. Can be empty | Free-form text or empty | "Use this for regional sales analysis" |
action | String | The action to perform on this verified query. ADD creates a new query, UPDATE modifies an existing query, DELETE removes a query | "add","update","delete" | "add" |
isSampleQuestion | Number | Whether this query should be shown as a sample question to users in the AI interface. 1=show as sample, 0=don't show as sample | 0,1 | 1 |
origin | Number | Origin of the query. 0=user-created through API/UI, 1=system-generated or imported. System-generated queries may have different handling | 0,1 | 0 |
visibility | JSON Object | Controls which users and groups can see and use this verified query. If not specified, query is visible to all users with access to the semantic model | - | {...} |
visibility.users | Array | Array of user identifiers who can see this verified query. Empty array means no user-specific restrictions | Array of user ID strings | ["user_123", "user_456"] |
visibility.groups | Array | Array of group identifiers who can see this verified query. Empty array means no group-specific restrictions | Array of group ID strings | ["group_789", "group_012"] |