oslew docs
Console
Menu

OperatoroperatoroperationId post_traffic

POST/v1/traffic

Apply a traffic feed: roads named by a point (or a stretch between two) with a speed or a factor on the release's time. Live routes answer by Dijkstra at once and by the hierarchy once it is contracted in the background. With ?format=tomtom or ?format=here the body is that vendor's flow JSON as returned by its API.

Send Authorization: Bearer sk_live_…. The key's plan must include theoperator product; which plans do.

Explained in Operator feeds.

Example

Paseo de la Reforma at a third of its speed.

curl
curl -X POST "https://api.oslew.com/v1/traffic" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"edges":[{"at":"19.4270,-99.1677","to":"19.4318,-99.1580","factor":3}]}'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.post_traffic(
    {
    "edges": [{"at": "19.4270,-99.1677", "to": "19.4318,-99.1580", "factor": 3}],
},
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.post_traffic({
  edges: [{ at: "19.4270,-99.1677", to: "19.4318,-99.1580", factor: 3 }],
});
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 10
ratelimit-remaining: 18
ratelimit-reset: 1

{
  "applied": true,
  "version": 1,
  "edges_updated": 39,
  "applied_at": 1790259566,
  "engine": "dijkstra",
  "took_us": 23312
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Query

NameTypeDescription
format
query
string
tomtom | here
The body is TomTom Flow Segment Data or HERE Traffic v7 flow rather than this service's edge list.

Body

application/json, required.

  • edgesobject[]required
    • atstringrequired
      lat,lon on the road.
    • factornumber
      On the release's time; 2 is twice as slow.
    • speed_kmhnumber
    • tostring
      lat,lon further along, for the whole stretch.

Responses

200 — Status after applying.

  • appliedbooleanrequired
  • applied_atinteger | nullrequired
  • edges_updatedintegerrequired
  • enginestringrequired
    none | dijkstra | hierarchy
  • took_usintegerrequired
  • versionintegerrequired

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400Bad request.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.