Define a job
Code Mode: praxis.workforce.jobs.create
HTTP: POST /workforce/v1/jobs
Creates a job: a reusable template of duties and methods that is copied onto each position opened from it. The new job starts at revision 1 and status active. code is your own unique key for the job inside the organization. level_ids restricts the levels positions of this job may carry (empty or omitted allows any level). Requires an organization owner or admin. Errors: 400 INVALID_PARAMS for an empty or duplicate code, a name over 100 characters, text over 4000 characters or an unknown body field; 403 PERMISSION_DENIED; 404 JOB_LEVEL_NOT_FOUND when a level id does not exist. Example body: {“code”:“support-agent”,“name”:“Support agent”,“duties”:“Answer customer tickets.”}.
签名
praxis.workforce.jobs.create(args:{body:{/** Your own unique key for the job inside the organization, 1 to 100 characters; it cannot be changed later. e.g. "support-agent" */ code:string;/** Job name, 1 to 100 characters; positions opened from the job default to it as their title. */ name:string;/** What the job is responsible for, at most 4000 characters; omit for an empty text. */ duties?:string;/** How the work is done, at most 4000 characters; omit for an empty text. */ methods?:string;/** Ids of the job levels (lvl_...) positions of this job may carry; omit or send an empty array to allow any level. */ level_ids?:Array<string>}}):Promise<{/** Job id (jpr_...); use it as job_id when opening positions. */ id:string;/** Id of the organization that owns the job. */ organization_id:string;/** Your own key for the job; unique inside the organization and fixed after creation. */ code:string;/** Job name, 1 to 100 characters; becomes the default title of positions opened from it. */ name:string;/** What the job is responsible for; copied onto positions when they are opened, at most 4000 characters. */ duties:string;/** How the work is done; copied onto positions when they are opened, at most 4000 characters. */ methods:string;/** Ids of the job levels (lvl_...) positions of this job may carry; an empty array allows any level. */ level_ids:Array<string>;/** Revision number, starting at 1 and rising on every revise; send it as expected_revision. */ revision:number;/** Whether the job can open new positions. */ status:"active"|"retired";/** UTC instant (RFC 3339) when the job was defined. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the job. */ update_time:string}>;请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/json |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 201 | application/json | The new job. |
| 400 | application/problem+json | INVALID_PARAMS; fix the field named in the message, or choose a code no other job uses. |
| 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 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 | JOB_LEVEL_NOT_FOUND; a level id in level_ids is not a level of your organization. Read ladders and copy level ids. |