Build applications with Semantic GraphQL
Query specific measures and dimensions through the Semantic GraphQL endpoint and get a structured response back in one request.
You are building an application that needs specific measures and dimensions from a Data Product, in a structured response, without polling for results. This recipe uses the Semantic GraphQL endpoint, where the client defines the exact fields it needs and receives the result in a single response. Use it when your application already uses GraphQL, needs only selected fields, and wants JSON results immediately. The journey is send a GraphQL query → read the response → validate it → make it reusable with variables.
What this enables:
Steps
1. Send a GraphQL query
curl --location \
'https://<DATAOS_FQDN>/vulcan/tenants/<DATAOS_TENANT_ID>/data-products/<DATAOS_TENANT_ID>-<resource-name>/api/v1/query/semantic/graphql' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${DATAOS_TOKEN}" \
--data '{
"query": "query {\n table(limit: 10) {\n customer_profile {\n count\n region_id\n }\n }\n}",
"variables": {}
}'The query requests:
customer_profile.countas a measure.customer_profile.region_idas a dimension.A maximum of 10 records.
Request only the fields your application uses, and keep a bounded limit. For result sets too large for one response, see Retrieve large result sets with pagination.
2. Read the response
The response has two parts:
dataholds the records. Its structure follows the fields you selected in the request:extensionsholds the execution metadata:FieldWhat to checkstatement_idUnique identifier created for the query execution.
statusConfirm that the query completed with
SUCCESS.strategyIndicates whether the query was executed or reused.
fingerprintIdentifies the normalized query for matching or reuse.
is_staleCheck whether the returned result is marked as stale.
_links.selfStatement endpoint associated with the query.
_links.resultResult endpoint associated with the statement.
3. Validate the response
Check both the GraphQL payload and the execution metadata before processing records. Check for GraphQL errors even when the HTTP request succeeds.
At minimum, confirm that:
The response does not contain a top-level
errorsarray.The expected object exists under
data.extensions.statusisSUCCESS.extensions.is_stalehas the expected value, when result freshness matters.The requested fields are present in every returned record.
4. Pass dynamic values with variables
When filter values or limits come from your application at runtime, pass them as GraphQL variables instead of building the query string yourself.
Variables keep the query reusable and separate its structure from runtime values.
Outcome
Your application requests exactly the measures and dimensions it needs, gets the result and its execution metadata in one response, and validates both before rendering or processing the records.
References
GraphQL API reference: full endpoint details and error behavior
Retrieve large result sets with pagination: for Semantic REST/SQL queries returning more than 50,000 records
Generate native warehouse SQL: inspect the SQL a semantic query would run, without executing it
Last updated
Was this helpful?