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 Discover API:

MethodPathDescription
GET/docsReturns the OpenAPI specification for this service in JSON format
POST/crosstabRanks codebook items by affinity with one audience
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​

Ranks codebook items by affinity with a single audience. The API only exposes and accepts datasets from the TelmarHelixa provider, and the result comes back in one payload.

FieldRequiredDescription
surveyCodeYesA dataset from the TelmarHelixa provider, such as HXUS
authorizationGroupYesAuthorization group provisioned for the caller
audienceYesExactly one coding statement
tableYesTable identifier (e.g. "#1")
weightIndexYesSurvey weight to apply
limitNoMaximum ranked items returned. Default 10, maximum 50
itemsNoOptional candidate items, ranked in the same items list

Understanding the audience​

audience is the single concept worth getting right first:

  • Exactly one statement — the audience every item is ranked against.
  • Empty, or more than one statement — rejected with 400.
  • A mnemonic you cannot access — rejected with 401.

surveyCode must be a dataset from the TelmarHelixa provider. The API does not expose datasets from any other provider.

A first request​

Sample data
curl — Discover ranking
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": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}'

How to read the response​

A successful response is an envelope around discover.items.

Response — ranked items — 200 OK (sample data)
{
"success": true,
"message": "ok",
"discover": {
"audienceSize": { "proj": 24180.2 },
"items": [
{
"rank": 1,
"mnemonic": "HX_BRAND_0412",
"label": "Brand A",
"affinity": 3.42,
"proj": 2210.4,
"audiencePercent": 9.14,
"itemPercent": 41.8,
"stability": 0
}
]
}
}

Read it in this order:

  1. success — true means the ranking finished. message is ok.
  2. discover.audienceSize.proj — projected size of the audience.
  3. discover.items — ranked items, capped at limit and sorted by affinity, then proj, then mnemonic.
  4. Each item — affinity is the ranking value. proj, audiencePercent, and itemPercent are the audience measures. stability of 0 is stable.

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 set success to false and put the reason in error:

Error envelope — 400 (sample data)
{
"success": false,
"error": "audience must be a single coding statement."
}
HTTPMeaningWhat to do
200Ranking succeededRead discover.items
400Bad request — audience, limit, or an audience that is too smallFix the payload
401Unauthorized — API key, or a mnemonic in the audience or in itemsSee Authentication
403Forbidden — the Discover API is not enabled for the accountConfirm permissioning with TelmarHelixa
500Internal server errorContact TelmarHelixa support
504Processing exceeded the gateway timeoutLower limit and retry
Branch on the status and error

Treat error as human-facing text that may change. Branch on the HTTP status, then read error to explain the failure.

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. A 504 means the ranking was too large for the gateway timeout — lower limit.