跳转到内容
EN

Revise a key result

Code Mode: praxis.workforce.keyResults.update

HTTP: PATCH /workforce/v1/key_results/{id}

Edits a key result; send at least one field. Progress is updated by this edit, not by check-in records: write metric.current for a metric key result, or done for a binary one, and set health as it changes. The holder of the owner position, when a person, may change only metric.current, health and done; an organization owner or admin, or the head of the objective’s home department or of a department above it, may change any field. An agent holding the position cannot write it. metric replaces the whole metric; done applies only to a key result without a metric. Errors: 400 INVALID_PARAMS when no field is given, done is sent for a key result that has a metric, or a field is malformed; 403 NOT_POSITION_HOLDER when the caller is neither a manager nor the position’s person holder; 403 PERMISSION_DENIED when a holder changes more than progress; 404 KEY_RESULT_NOT_FOUND or POSITION_NOT_FOUND; 409 PERIOD_CLOSED when the objective is graded or its period is closed; 409 POSITION_CLOSED for a closed new owner. Example body: {“metric”:{“initial”:6,“current”:3.5,“target”:2,“unit”:“none”},“health”:“at_risk”}.

签名

praxis.workforce.keyResults.update(args:{path:{id:string};body:{/** New title, 1 to 200 characters; a manager or department head only. */ title?:string;/** Id of the open position (pos_...) that becomes the owner; a manager or department head only. */ owner_position_id?:string;/** New commitment; a manager or department head only. e.g. "aspirational" */ commitment?:"committed"|"aspirational";/** The whole new metric, replacing the old one; the owner's holder may change only its current. */ 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"});/** The owner's latest read on whether the key result will land. e.g. "at_risk" */ health?:"on_track"|"at_risk"|"off_track";/** Whether a binary key result is complete; refused for a key result that has a metric. */ done?:boolean}}):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}>;

参数

名称位置类型必填说明
idpathstring是Key result id (kr_…) to revise, from the key results list.

请求体

必填内容类型说明
是application/json

响应

状态码内容类型说明
200application/jsonThe key result after the change.
400application/problem+jsonINVALID_PARAMS; send at least one valid field, and send done only for a key result without a metric.
401Missing or invalid credential; provide a valid organization API key or sign in to the Console.
403application/problem+jsonNOT_POSITION_HOLDER or PERMISSION_DENIED; only the person holding the owner position, an organization owner or admin, or the head of the objective’s home department or of a department above it may write, a holder may change only metric.current, health and done, and machine tokens are always refused (an agent’s session token may read the organization, never change it).
404application/problem+jsonKEY_RESULT_NOT_FOUND or POSITION_NOT_FOUND; list key results and positions and copy ids of your organization.
409application/problem+jsonPERIOD_CLOSED or POSITION_CLOSED; a graded objective or closed period takes no more edits, and a closed position cannot own a key result.