Set a key result
Code Mode: praxis.workforce.keyResults.create
HTTP: POST /workforce/v1/key_results
Sets a key result under an active objective: a measurable outcome owned by one position, whose current holder moves its progress. Give a metric to measure it by numbers; omit metric for a binary key result, whose progress is its done flag. It starts with health on_track, done false and no score. Requires an organization owner or admin, or the head of the objective’s home department or of a department above it. Errors: 400 INVALID_PARAMS for an empty title, a title over 200 characters, a commitment outside the list, a metric whose target equals its initial value or whose unit is outside the list, or an unknown body field; 403 PERMISSION_DENIED; 404 OBJECTIVE_NOT_FOUND or POSITION_NOT_FOUND; 409 PERIOD_CLOSED when the objective is graded or its period is closed; 409 POSITION_CLOSED when the owner position is closed. Example body: {“objective_id”:“obj_3b7a52c1e9d84f06b2a1c8e4d7f50a96”,“title”:“Median first response under 2 hours”,“owner_position_id”:“pos_7a1c5e92d3b84f60a9e2c4d8b1f30a57”,“commitment”:“committed”,“metric”:{“initial”:6,“target”:2,“unit”:“none”}}.
签名
praxis.workforce.keyResults.create(args:{body:{/** Id of the active objective (obj_...) the key result belongs to; list objectives to find it. e.g. "obj_3b7a52c1e9d84f06b2a1c8e4d7f50a96" */ objective_id:string;/** Key result title, 1 to 200 characters. e.g. "Median first response under 2 hours" */ title:string;/** Id of the open position (pos_...) that owns the key result; its holder moves the progress. e.g. "pos_7a1c5e92d3b84f60a9e2c4d8b1f30a57" */ owner_position_id:string;/** Whether the key result is a firm commitment or a stretch. e.g. "committed" */ commitment:"committed"|"aspirational";/** The numbers to measure by; omit for a binary key result whose progress is the done flag. */ metric?:({/** Value when the key result starts; progress counts from here. e.g. 6 */ initial:number;/** Latest value; omit to start at initial. e.g. 6 */ current?:number;/** Value that means the key result is reached; it must differ from initial. e.g. 2 */ target:number;/** Unit of the three values. e.g. "none" */ unit:"none"|"percent"|"currency_micro_usd"|"count"|"seconds"})}}):Promise<{/** Key result id (kr_...); use it in key_result_scores. */ id:string;/** Id of the organization that owns the key result. */ organization_id:string;/** Id of the objective (obj_...) the key result belongs to. */ objective_id:string;/** Key result title, 1 to 200 characters. */ title:string;/** Id of the position (pos_...) that owns the key result; whoever holds it moves its progress. */ owner_position_id:string;/** Whether the key result is a firm commitment or a stretch. */ commitment:"committed"|"aspirational";/** The numbers the key result is measured by, or null for a binary key result whose progress is done. */ metric:{/** Value when the key result started; progress counts from here. e.g. 6 */ initial:number;/** Latest value; update it to move progress. e.g. 6 */ current:number;/** Value that means the key result is reached; it differs from initial and may be lower than it when the number should fall. e.g. 2 */ target:number;/** Unit of the three values. e.g. "none" */ unit:"none"|"percent"|"currency_micro_usd"|"count"|"seconds"}|null;/** Whether a binary key result is complete; it only counts when metric is null. */ done:boolean;/** The owner's latest read on whether the key result will land. */ health:"on_track"|"at_risk"|"off_track";/** Score from 0 to 1 recorded when the objective was graded; null until then or when grading left it out. */ score:number|null;/** UTC instant (RFC 3339) when the key result was set. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the key result. */ update_time:string}>;请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | The new key result. |
| 400 | application/problem+json | INVALID_PARAMS; fix the title, commitment, metric or unknown body field named in the message. |
| 401 | Missing or invalid credential; provide a valid organization API key or sign in to the Console. | |
| 403 | application/problem+json | PERMISSION_DENIED; an organization owner or admin, or the head of the home department of the key result’s objective or of a department above it may call this, and machine tokens are always refused (an agent’s session token may read the organization, never change it). Use an API key or Console session of an allowed role. |
| 404 | application/problem+json | OBJECTIVE_NOT_FOUND or POSITION_NOT_FOUND; list objectives and positions and copy ids of your organization. |
| 409 | application/problem+json | PERIOD_CLOSED or POSITION_CLOSED; set key results only under an active objective, owned by an open position. |