Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

Prerequisites: a DataOS API token and the Data Product's API base URL. See Authentication. Keep the token outside your application's source code.

Unlike the asynchronous Semantic SQL and REST flow, the GraphQL endpoint returns the query result and execution metadata in the same response. A statement_id is still created and returned under extensions, but no additional polling is required when the returned status is SUCCESS.

Steps

1. Send a GraphQL query

Semantic GraphQL request
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.count as a measure.

  • customer_profile.region_id as 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:

  • data holds the records. Its structure follows the fields you selected in the request:

  • extensions holds the execution metadata:

    Field
    What to check

    statement_id

    Unique identifier created for the query execution.

    status

    Confirm that the query completed with SUCCESS.

    strategy

    Indicates whether the query was executed or reused.

    fingerprint

    Identifies the normalized query for matching or reuse.

    is_stale

    Check whether the returned result is marked as stale.

    _links.self

    Statement endpoint associated with the query.

    _links.result

    Result 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 errors array.

  • The expected object exists under data.

  • extensions.status is SUCCESS.

  • extensions.is_stale has 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

Last updated

Was this helpful?