Measurements With the SDK
Measurements With the SDK
Use the current released SDK supported by your Custd deployment. Initialize
client with your tenant's authenticated base URL and credential flow before
these snippets; see SDK contract. These are workflow
examples after initialization, not standalone programs. Replace historical
target/observation dates with the intended measurement period.
TypeScript
await client.admin.measurement.projects.create({
projectSlug: "checkout-runway",
name: "Checkout Runway",
kind: "deadline_forecast",
series: [{
seriesSlug: "checkout-completions",
name: "Checkout completions",
unit: "count",
completionDirection: "increase",
source: "manual",
}],
target: {
targetSlug: "release",
name: "Release",
targetValue: 100,
targetDate: "2026-08-31T00:00:00Z",
state: "active",
},
});
const csv = "seriesSlug,observedAt,value\ncheckout-completions,2026-07-01T00:00:00Z,42\n";
await client.admin.measurement.projects.importCSVString("checkout-runway", csv, 1);
Go
project, err := client.Admin.Measurement.Projects.Create(ctx, custd.MeasurementProjectCreate{
ProjectSlug: "checkout-runway",
Name: "Checkout Runway",
Kind: "deadline_forecast",
Series: []custd.MeasurementSeriesCreate{{
SeriesSlug: "checkout-completions",
Name: "Checkout completions",
Unit: "count",
CompletionDirection: "increase",
Source: "manual",
}},
Target: custd.MeasurementTargetCreate{
TargetSlug: "release",
Name: "Release",
TargetValue: 100,
TargetDate: "2026-08-31T00:00:00Z",
State: "active",
},
})
PHP
$project = $client->adminMeasurementProjects()->create([
'projectSlug' => 'checkout-runway',
'name' => 'Checkout Runway',
'kind' => 'deadline_forecast',
'series' => [[
'seriesSlug' => 'checkout-completions',
'name' => 'Checkout completions',
'unit' => 'count',
'completionDirection' => 'increase',
'source' => 'manual',
]],
'target' => [
'targetSlug' => 'release',
'name' => 'Release',
'targetValue' => 100,
'targetDate' => '2026-08-31T00:00:00Z',
'state' => 'active',
],
]);
Python
project = client.admin.measurement.projects.create({
"projectSlug": "checkout-runway",
"name": "Checkout Runway",
"kind": "deadline_forecast",
"series": [{
"seriesSlug": "checkout-completions",
"name": "Checkout completions",
"unit": "count",
"completionDirection": "increase",
"source": "manual",
}],
"target": {
"targetSlug": "release",
"name": "Release",
"targetValue": 100,
"targetDate": "2026-08-31T00:00:00Z",
"state": "active",
},
})
SDK helpers validate that import responses contain one result per submitted row
and that every successful row includes observationUuid. Failed rows retain
their RFC 9457 problem fields.
Keep the created project's identifiers, import one valid row and inspect its result before adding volume. Then run a forecast and inspect Measure. A project without observations is not a populated forecast. Handle duplicate slugs by inspecting the existing project; do not blindly repeat creation after an uncertain response.