Rename batchTrack endpoint to balances.batch_track
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Batch Track Usage"
|
||||
openapi: "openapi POST /v1/balances.batchTrack"
|
||||
openapi: "openapi POST /v1/balances.batch_track"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/snippets/dynamic-param-field.jsx";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Batch Track Usage"
|
||||
openapi: "openapi POST /v1/balances.batchTrack"
|
||||
openapi: "openapi POST /v1/balances.batch_track"
|
||||
---
|
||||
|
||||
import { DynamicParamField } from "/snippets/dynamic-param-field.jsx";
|
||||
|
||||
@@ -16399,7 +16399,7 @@ paths:
|
||||
feature_id="messages",
|
||||
value=1,
|
||||
)
|
||||
/v1/balances.batchTrack:
|
||||
/v1/balances.batch_track:
|
||||
post:
|
||||
operationId: batchTrack
|
||||
description: >-
|
||||
@@ -16492,7 +16492,7 @@ paths:
|
||||
]);
|
||||
- lang: curl
|
||||
source: |-
|
||||
curl -X POST https://api.useautumn.com/v1/balances.batchTrack \
|
||||
curl -X POST https://api.useautumn.com/v1/balances.batch_track \
|
||||
-H 'Authorization: Bearer <token>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '[
|
||||
|
||||
@@ -9,7 +9,7 @@ description: "Some new things we've shipped at Autumn HQ"
|
||||
|
||||
Two new ways to record usage when you don't need an immediate balance read:
|
||||
|
||||
- [`POST /v1/balances.batchTrack`](/api-reference/core/batchTrack) — enqueue up to **1000 usage events** in one request. Returns 202 immediately; balances are deducted by background workers.
|
||||
- [`POST /v1/balances.batch_track`](/api-reference/core/batchTrack) — enqueue up to **1000 usage events** in one request. Returns 202 immediately; balances are deducted by background workers.
|
||||
- **`async: true`** on the existing [`POST /v1/balances.track`](/api-reference/core/track) — same fire-and-forget shape for single-event callers that want the speed without switching to the batch endpoint.
|
||||
|
||||
Both paths are intended for high-volume metering (event logging, per-action usage counters) where you'd previously be limited by the synchronous deduction's HTTP round-trip. Partial enqueue failures are logged server-side and do NOT surface as errors to the client — see the [batch track reference](/api-reference/core/batchTrack#partial-failure-semantics) for the trade-off.
|
||||
|
||||
@@ -160,7 +160,7 @@ export const balancesTrackContract = oc
|
||||
export const balancesBatchTrackContract = oc
|
||||
.route({
|
||||
method: "POST",
|
||||
path: "/v1/balances.batchTrack",
|
||||
path: "/v1/balances.batch_track",
|
||||
operationId: "batchTrack",
|
||||
description: "Track multiple usage events asynchronously.",
|
||||
spec: (spec) =>
|
||||
|
||||
@@ -34,6 +34,6 @@ balancesRpcRouter.post("/balances.update", ...handleUpdateBalance);
|
||||
balancesRpcRouter.post("/balances.delete", ...handleDeleteBalance);
|
||||
|
||||
balancesRpcRouter.post("/balances.track", ...handleTrack);
|
||||
balancesRpcRouter.post("/balances.batchTrack", ...handleBatchTrack);
|
||||
balancesRpcRouter.post("/balances.batch_track", ...handleBatchTrack);
|
||||
balancesRpcRouter.post("/balances.check", ...handleCheck);
|
||||
balancesRpcRouter.post("/balances.finalize", ...handleFinalizeLock);
|
||||
|
||||
@@ -88,7 +88,7 @@ const RATE_LIMIT_ROUTE_GROUPS: RateLimitRouteGroup[] = [
|
||||
},
|
||||
{
|
||||
type: RateLimitType.BatchTrack,
|
||||
patterns: [route({ method: "POST", url: "/v1/balances.batchTrack" })],
|
||||
patterns: [route({ method: "POST", url: "/v1/balances.batch_track" })],
|
||||
},
|
||||
{
|
||||
type: RateLimitType.Check,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Retrospective contract coverage for POST /v1/balances.batchTrack.
|
||||
* Retrospective contract coverage for POST /v1/balances.batch_track.
|
||||
*
|
||||
* This file is the HTTP-layer contract of record for the batch async-track
|
||||
* endpoint. It exercises everything the customer can observe by talking to
|
||||
@@ -8,7 +8,7 @@
|
||||
* Contract (full surface, verbatim from the spec):
|
||||
*
|
||||
* New endpoint:
|
||||
* - POST /v1/balances.batchTrack
|
||||
* - POST /v1/balances.batch_track
|
||||
* request body: BatchTrackParams = TrackParams[] where 1 <= len <= 1000
|
||||
* response: 202, body { success: true }
|
||||
* auth: requires Scopes.Balances.Write
|
||||
@@ -139,7 +139,7 @@ const postBatchTrack = async ({
|
||||
headers.Authorization = authorization;
|
||||
}
|
||||
|
||||
const response = await fetch(`${autumn.baseUrl}/balances.batchTrack`, {
|
||||
const response = await fetch(`${autumn.baseUrl}/balances.batch_track`, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify(body),
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* If this test starts failing:
|
||||
* DO NOT "fix" it by undoing the pin. The fix is to add idempotency
|
||||
* keys to the /v1/balances.batchTrack API contract — at which point
|
||||
* keys to the /v1/balances.batch_track API contract — at which point
|
||||
* this file should be rotated to assert the NEW dedup contract
|
||||
* (client-supplied keys produce stable MessageDeduplicationId across
|
||||
* client-driven retries). Until then, this behavior is intentional.
|
||||
|
||||
Reference in New Issue
Block a user