跳转到内容
EN

Transfer an assignment to another position

Code Mode: praxis.workforce.assignments.transfer.create

HTTP: POST /workforce/v1/assignments/{id}/transfer

Moves the actor from its current position to another vacant one: the current assignment ends with reason transferred and a new one starts in the target position, keeping the primary flag, so a primary assignment stays primary. Use it for a move or promotion; use terminate when the actor leaves the position without another. Only a current assignment can be transferred. The target must be active and vacant. Needs write rights over both departments: an organization owner or admin, or a head whose department is, or is above, both the department being left and the target’s department. Errors: 400 INVALID_PARAMS for a missing to_position_id or a target equal to the current position; 403 PERMISSION_DENIED; 404 ASSIGNMENT_NOT_FOUND for an unknown or already ended assignment; 404 POSITION_NOT_FOUND for the target; 409 POSITION_FROZEN, POSITION_CLOSED or POSITION_OCCUPIED for the target. Example body: {“to_position_id”:“pos_456”}.

签名

praxis.workforce.assignments.transfer.create(args:{path:{id:string};body:{/** Id of the active vacant position (pos_...) the actor moves to; it must differ from the current position. */ to_position_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}>;

参数

名称位置类型必填说明
idpathstring是Assignment id (asg_…) to move, from the assignments list.

请求体

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

响应

状态码内容类型说明
201application/jsonThe new assignment in the target position.
400application/problem+jsonINVALID_PARAMS; send a to_position_id that differs from the position the assignment already sits in.
401Missing or invalid credential; provide a valid organization API key or sign in to the Console.
403application/problem+jsonPERMISSION_DENIED; an organization owner or admin, or a head covering both the department being left and the target’s department 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.
404application/problem+jsonASSIGNMENT_NOT_FOUND or POSITION_NOT_FOUND; list assignments for a current assignment id and list positions for the target.
409application/problem+jsonPOSITION_FROZEN, POSITION_CLOSED or POSITION_OCCUPIED; pick an active vacant target position, unfreezing it first if needed.