Créer des API

Cette page est offerte en anglais seulement.

Datasets, Requests, and Responses

Three decisions define an API product — what data backs it, what callers can ask, and what comes back.

Mis à jour le 2026-09-015 minutes de lecture
Avant de commencer
  • Familiarity with your datasets in the Data Store

Three decisions define an API product. Get them right and you're finished — there's no code to write.

What data backs it

Attach one or more datasets. Your data isn't copied anywhere; the product reads what you keep managing in the Data Store.

Attaching more than one widens what the product can answer — an address product can match against both a civic address dataset and your own site records.

What callers can ask

Rather than writing endpoint code, you point request parameters at your columns: which columns callers can filter on, or which columns make up "an address" in your data.

Expose only what they need. Every parameter is surface you'll be maintaining for a long time.

Asking by location

When your dataset carries a location — a mapped latitude/longitude pair, or point geometry — a Data API answers spatial questions without any parameter you have to define:

  • ?near=51.04,-114.07,5km — everything within a radius of a point, nearest first. Radius takes m, km or mi.
  • ?bbox=west,south,east,north — everything inside a box, in the same longitude-then-latitude order maps and GeoJSON use. A box may cross the antimeridian.

Both combine with your ordinary filters: ?near=51.04,-114.07,5km&status=active. Distance is true great-circle distance, so 5 km means the same thing in Iqaluit as in Calgary.

The Design tab tells you when this is on for a product. It becomes available after the first Index & Save that follows attaching a dataset with locations — it's a property of the built index, not a setting.

What comes back

You pick the response fields the same way, and only those come back. This is how you serve a public-facing product from a dataset that also carries internal columns.

A near query adds one thing you didn't pick: distance_m, the metres from the point you asked about, on every result. It sits beside your fields rather than among them, because it's computed per request, not stored in your data.

When a request cannot be served, the response says why in plain words (detail) and carries a stable code your integration can branch on — common.not_found, common.forbidden, common.rate_limited and the like — instead of parsing the sentence.

Next steps