Skip to main content

Endpoint how-to

This page takes you from a base URL to a parsed response. Every payload below is synthetic and labelled as sample data — the shared constants they all reuse are documented once in the example gallery.

Base URL

All paths are relative to:

Base URL
https://engines.api.telmar.com/omg/prd/v1

The following endpoints are available under the Explore API:

MethodPathDescription
GET/docsReturns the OpenAPI specification for this service in JSON format
POST/crosstabExecutes a crosstab query against the dataset and returns weighted audience results
OPTIONS/crosstabCORS preflight check for the /crosstab endpoint

Authenticated requests need a Telmar-Engine-Authorizer API key. See Authentication if you do not have one yet.

POST /crosstab

Executes a crosstab query against a specified survey dataset. Returns weighted audience counts, unweighted respondent counts, and stability indicators for each requested target code.

FieldRequiredDescription
SurveyCodeYesIdentifies the target survey dataset (e.g. "M20F")
PopulationBaseCodeYesPopulation base for the query (e.g. "AR18_24")
TargetCodesYesTarget segment codes. Min 1, max 2
AuthorizationGroupNoAuthorization group filter. Use "_ALL_" to include all groups

Understanding target codes

TargetCodes is the single concept worth getting right first:

  • 1 target — a single demographic cut against the population base.
  • 2 targets — a side-by-side comparison (the shape used in the official sample).
  • More than 2 — rejected with 400. Split across multiple calls.

Each entry in TargetCodes produces one object in Results, in the same order.

A first request

Sample data
curl — basic crosstab
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"SurveyCode": "M20F",
"AuthorizationGroup": "_ALL_",
"PopulationBaseCode": "AR18_24",
"TargetCodes": ["OMEN", "OWOMEN"]
}'

How to read the response

A successful response is an envelope around a small Results array.

Response — two targets — 200 OK (sample data)
{
"ResultCode": 0,
"ResultDescription": "",
"Results": [
{ "Resps": 1000, "WgtAud": 10000, "Stbl": 0 },
{ "Resps": 123, "WgtAud": 4444, "Stbl": 1 }
],
"AudienceReportUnits": 1000
}

Read it in this order:

  1. ResultCode0 means success. A value greater than 0 is a partial or conditional result — check ResultDescription.
  2. Results — one object per TargetCodes entry, in the same order.
    • Resps — unweighted respondents matching the target
    • WgtAud — weighted projected audience; multiply by AudienceReportUnits for the absolute figure
    • Stbl0 stable, 1 unstable (low respondent counts — use with caution)
  3. AudienceReportUnits — audience unit multiplier (e.g. 1000 means WgtAud is in thousands).
Do not ignore stability

Stbl of 1 means the result is unstable. Unstable results indicate low respondent counts and should be used with caution.

GET /docs

Returns the full OpenAPI specification for this service as a JSON object. Useful for programmatic discovery of the API schema. No authentication is required.

curl — OpenAPI document (sample data)
curl 'https://engines.api.telmar.com/omg/prd/v1/docs' \
-H 'Accept: application/json'

The full (abridged) response is in the gallery below.

OPTIONS /crosstab

CORS preflight for the /crosstab path. Browsers issue this automatically before cross-origin POST requests. Returns 200 — everything useful is in the headers.

curl — show response headers (sample data)
curl -X OPTIONS 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: POST' -i

Access-Control-Allow-Methods and Access-Control-Allow-Headers tell the browser what it may send. This call is not billed.

Errors

Failures use ResultCode / ResultDescription, optionally with a nested error object for machine-readable branching:

Error envelope — 4xx (sample data)
{
"ResultCode": 400,
"ResultDescription": "TargetCodes must contain between 1 and 2 items.",
"error": {
"code": "invalid_target_codes",
"message": "TargetCodes must contain between 1 and 2 items.",
"field": "TargetCodes",
"hint": "Split the request into multiple crosstab calls of at most two targets each."
}
}
HTTPResultCodeMeaningWhat to do
2000SuccessUse Results as normal
200> 0Partial or conditional resultCheck ResultDescription
400Bad request — malformed JSON or missing required fieldsFix the payload
401Unauthorized — verify API key or Cognito credentialsSee Authentication
403Forbidden — no access to the requested datasetConfirm permissioning with TelmarHelixa
500Internal server errorContact TelmarHelixa support
Branch on code, not message

Prefer error.code when present; fall back to ResultCode. Treat ResultDescription / error.message as human-facing text that may change.

Two rules worth building in from the start:

  • 400, 401 and 403 are not retryable. The same request will fail the same way. Fix it or surface it.
  • 5xx are retryable with exponential backoff.