Replace a position's holder
Code Mode: praxis.workforce.positions.replaceHolder.create
HTTP: POST /workforce/v1/positions/{id}/replace_holder
Ends the current holder’s assignment with reason replaced and seats the successor in the same step, so the position is never vacant in between; the ended assignment records the successor’s assignment id as successor_assignment_id. Nothing the predecessor learned or remembered passes to the successor, because experience belongs to the actor, not the position. The successor must exist in your organization and not be archived; it becomes primary if it holds nothing else, otherwise a concurrent assignment. If the predecessor was primary and holds other positions, the earliest of those becomes its primary. request_id makes the call idempotent: repeating it returns the first result and replaces nobody again. Requires an organization owner or admin, or the head of the position’s department or of a department above it. Errors: 400 INVALID_PARAMS for a missing successor or request_id, a successor that already holds this position or an unknown body field; 403 PERMISSION_DENIED; 404 POSITION_NOT_FOUND; 404 ACTOR_NOT_FOUND for the successor; 409 POSITION_VACANT when nobody holds the position, so use hire instead. Example body: {“successor”:“agent:agent_123”,“request_id”:“replace-support-1”}.
签名
praxis.workforce.positions.replaceHolder.create(args:{path:{id:string};body:{/** Actor address of the member or agent who takes the position, such as agent:agent_123; it must differ from the current holder. */ successor:string;/** Your own unique key for this request; repeating it returns the first result instead of replacing again. e.g. "replace-support-1" */ request_id:string}}):Promise<{/** Assignment id (asg_...); use it with transfer, terminate and make_primary. */ id:string;/** Id of the organization that owns the assignment. */ organization_id:string;/** Id of the position (pos_...) the actor holds. */ position_id:string;/** Actor address of the holder, such as human:usr_123 for a person or agent:agent_123 for an agent. */ actor:string;/** The holder's display name from the organization's directory, archived agents included, so a past holder is still named; null when the directory does not know th */ actor_name:string|null;/** Whether this is the actor's primary assignment; an actor holding positions has exactly one primary, and the others are concurrent. */ primary:boolean;/** UTC instant (RFC 3339) when the actor took the position. */ start_time:string;/** UTC instant (RFC 3339) when the assignment ended; null while it is current. */ end_time:string|null;/** Why the assignment ended; null while it is current. */ end_reason:"resigned"|"dismissed"|"replaced"|"retired"|"transferred"|"position_closed"|"actor_archived"|null;/** Actor address that made the appointment, such as human:usr_123. */ appointed_by:string;/** Actor address that ended the assignment; null while it is current. */ ended_by:string|null;/** Id of the successor's assignment (asg_...) when the holder was replaced in one step; null otherwise. */ successor_assignment_id:string|null;/** UTC instant (RFC 3339) when the assignment was recorded. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the assignment. */ update_time:string}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| id | path | string | 是 | Position id (pos_…) whose holder changes, from the positions list. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | The successor’s new assignment to the position. |
| 400 | application/problem+json | INVALID_PARAMS; send a successor address other than the current holder and a request_id. |
| 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 position’s department 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 | POSITION_NOT_FOUND or ACTOR_NOT_FOUND; list positions for the id, and list members or agents for the successor address. |
| 409 | application/problem+json | POSITION_VACANT; the position has no holder to replace, so hire into it. |
| 503 | application/problem+json | ACTOR_SYNCING; the successor agent exists but is still being synced into the organization roster. Wait retry_after seconds (also sent as Retry-After) and call again with the same request_id. |