List a project's units
Code Mode: praxis.devops.projects.units.list
HTTP: GET /devops/v1/projects/{project}/units
List the project’s units from their stored record, newest first, without reaching any machine — a list of N units is one read, not N reads against N machines. Use it to find a unit’s id, to see which changes currently have one, or to find units that ended badly. Narrow it by stage, by change (the branch name) or by phase; a stage or phase outside the vocabulary is refused with INVALID_ARGUMENT rather than ignored. totalSize is answered on the first page only. The phase a unit shows here is what was last recorded; read the unit itself for a fresh observation.
签名
praxis.devops.projects.units.list(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string};query?:{/** e.g. 20 */ pageSize?:number;/** e.g. "pt1.eyJvIjoyMH0" */ pageToken?:string;stage?:"development"|"integration"|"release";/** e.g. "feat/run-page-v2" */ change?:string;phase?:"queued"|"provisioning"|"available"|"shutting_down"|"shutdown"|"starting"|"failed"|"deleted"}}):Promise<{/** The units on this page, each with its phase, spec and sandbox handle. */ items:Array<{/** The unit identifier, used by every other unit operation and never reused once the unit is deleted. e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always unit. */ object:"unit";/** RFC 3339 UTC time the unit was opened; the unit list is ordered by it, newest first. e.g. "2026-11-11T10:00:00Z" */ createTime:string;/** RFC 3339 UTC time the unit's own fields last changed. e.g. "2026-11-11T10:05:00Z" */ updateTime:string;/** Canonical Console link for this unit; use it in a message so a person can open the same machine. e.g. "https://console.deepraxis.com/devops/dvp_01m6j8swzteapw2j5sh4/units/wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this unit belongs to, from the project list. e.g. "dvp_01m6j8swzteapw2j5sh4" */ project:string;/** The workspace configuration this unit was created from, from the project's workspace list. e.g. "wks_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ workspace:string;stage:"development"|"integration"|"release";/** What sort of work the unit carries, which is the subject's kind with the run kinds spelled out. e.g. "change" */ kind:"change"|"environment_run"|"test_run"|"prebuild_build";subject:{/** Which kind of subject this unit serves. e.g. "change" */ kind:"change"|"environment"|"test"|"prebuild";/** The change this unit develops, present when kind is change; the id is the change's branch name, such as feat/run-page-v2. e.g. "feat/run-page-v2" */ change?:string|null;/** The environment the run belongs to, present when kind is environment; from the project's environment list. e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment?:string|null;/** The promotion that opened the run, present when kind is environment. e.g. "prm_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ promotion?:string|null;/** The test run this unit serves, present when kind is test. e.g. "trn_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ run?:string|null;/** The commit being prebuilt, present when kind is prebuild; a full 40-character commit. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ commit?:string|null};spec:{/** The state the unit was last asked to be in; it does not change when the machine fails, so a failed unit can still read running here. e.g. "running" */ desired:"running"|"stopped"|"deleted";/** How many times the unit's spec has been written; it rises with each verb, so an observation can be matched against the spec it saw. e.g. 2 */ specVersion:number;size:"small"|"medium"|"large"|"xlarge";source:{/** Which source the unit's machine was created from. e.g. "template" */ kind:"template"|"prebuild";/** The template the machine was built from, present when kind is template. e.g. "base" */ template?:string|null;/** The prebuild the machine started from, present when kind is prebuild. e.g. "pbd_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ prebuild?:string|null;/** The commit the prebuild was built at, present when kind is prebuild. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ commit?:string|null}};status:{phase:"queued"|"provisioning"|"available"|"shutting_down"|"shutdown"|"starting"|"failed"|"deleted";/** RFC 3339 UTC time the phase was last observed, or null before the first observation; a phase older than expected means the machine has not been read recently. e.g. "2026-11-11T10:05:00Z" */ observedAt:string|null;/** Why the unit stopped, or null while it is not stopped. */ stopReason:null|"user"|"idle"|"max_running"|"change_closed"|"lost"|"completed";/** The sandbox's own words for why the machine ended, quoted verbatim and never rewritten; null while the unit has not ended. e.g. "The instance was terminated by the provider." */ terminationReason:string|null;/** The sandbox handle for this unit's machine, or null before the sandbox has placed one and after it is gone; it never carries a vendor name. */ sandbox:null|{/** The sandbox's id for this machine; treat it as opaque and never parse it. e.g. "sbx_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ instance:string;/** Opaque route to the running machine, used by the platform to reach it; never build one from an instance id. e.g. "rt-a1b2c3d4e5f6" */ route:string}};/** What the unit's checkout last showed, or null before any observation has been recorded. */ git:null|{/** The branch checked out on the machine, which is the change's branch name. e.g. "feat/run-page-v2" */ branch:string;/** The commit the branch was last observed at, or null before any observation. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ head:string|null;/** How many commits the branch is ahead of the base the checkout was compared with; 0 before any observation. e.g. 0 */ ahead:number;/** How many commits the branch is behind that base; 0 before any observation. e.g. 0 */ behind:number;/** Whether the checkout has changes that were not committed; a unit with this true is refused by delete unless force is sent. e.g. false */ uncommitted:boolean;/** Whether the branch has commits that were not pushed; a unit with this true is refused by delete unless force is sent. e.g. false */ unpushed:boolean;/** The ref holding the unit's work in progress, or null when none was recorded. e.g. null */ wipRef:string|null;/** The branch's head on the remote as of the last fetch: the value units push wants as expectedHead. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ remoteHead?:string;/** RFC 3339 UTC time these facts were observed, or null before the first observation. e.g. "2026-11-11T10:04:00Z" */ observedAt:string|null};/** Whether the unit started from a prebuild that is no longer the current one, so it should be opened again to pick up the latest; false for template units. e.g. false */ stale:boolean;/** RFC 3339 UTC time after which a stopped unit is destroyed, or null while it is running or has no retention. e.g. "2026-11-18T10:05:00Z" */ retainUntil:string|null;/** RFC 3339 UTC time the unit was last seen doing something, used to decide idleness, or null before any activity was observed. e.g. "2026-11-11T10:05:00Z" */ lastActiveTime:string|null;/** The unit's most recent transition records, present only when the retrieve asked for expand=transitions. */ transitions?:Array<{/** Position in the unit's record, starting at 1 and rising by one; read the records in this order. e.g. 1 */ seq:number;/** The unit this record belongs to. e.g. "wsu_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ unit:string;/** The verb this record is about. e.g. "create" */ transition:"create"|"start"|"stop"|"delete"|"fetch"|"push"|"wip"|"observe"|"exec";/** What moved the unit: a caller, or something the platform noticed. e.g. "user" */ reason:"user"|"agent"|"idle"|"change_merged"|"change_abandoned"|"retention"|"lost"|"system";/** Who asked, written as human:<user id>, agent:<agent id> or system, so the record reads the way it did when it was written. e.g. "human:usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ actor:string;/** The unit spec version this verb was applied to, matching the specVersion on the unit at that time. e.g. 1 */ specVersion:number;/** RFC 3339 UTC time the verb was accepted. e.g. "2026-11-11T10:00:00Z" */ startedAt:string;/** RFC 3339 UTC time the verb finished, or null while it is still pending. e.g. "2026-11-11T10:00:20Z" */ finishedAt:string|null;/** How the verb ended: pending while it is in flight, then succeeded or failed. e.g. "succeeded" */ outcome:"pending"|"succeeded"|"failed";/** Why the verb failed, or null when it did not. */ error:null|{/** The refusal's code, the sandbox's own when it came from there; treat it as text to show, not as a platform error code to branch on. e.g. "instance_creation_failed" */ code:string;/** The refusal's message, the sandbox's own words when it came from there. e.g. "no instance available in the requested region" */ message:string}}>}>;/** How many units the project and filter match across every page; returned on the first page only. e.g. 2 */ totalSize?:number;/** Cursor for the next page; an empty string means this was the last page, which is the only signal a list is finished. e.g. "pt1.eyJvIjo1MH0" */ nextPageToken:string}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| project | path | string | 是 | Identifies the project whose data you are reading, from the project list or create answer. |
| pageSize | query | number | 否 | How many items this page returns, 1 to 100; omitted uses 50. A larger value is capped at 100 rather than refused, and 0 falls back to the default, so a paging loop never fails on a size alone. |
| pageToken | query | string | 否 | The cursor from the previous page’s nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page. |
| stage | query | “development” | “integration” | “release” | 否 | Return only units of this stage; omit it to return every stage. |
| change | query | string | 否 | Return only the unit opened for this change, named by its branch id such as feat/run-page-v2; omit it to return units of every change. |
| phase | query | “queued” | “provisioning” | “available” | “shutting_down” | “shutdown” | “starting” | “failed” | “deleted” | 否 | Return only units in this phase, such as failed to find what needs attention; omit it to return every phase. |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | One page of the project’s units, newest first, narrowed by the filters. |
| 400 | application/json | INVALID_PARAMS or INVALID_ARGUMENT means a field, query value or identifier violates the documented format or range — an unknown enum value, a pageSize outside 1..100, an unsupported filter or orderBy field, or an id with the wrong prefix. Correct the named input; nothing was read or written. |
| 401 | application/json | The API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying. |
| 403 | application/json | The credential carries no organization, or that organization cannot reach this project; use a key belonging to the project’s organization. No cross-organization read is possible. |
| 404 | application/json | PROJECT_NOT_FOUND means no project with that id is visible to this organization; list the projects and use an id from that answer. |
| 500 | application/json | INTERNAL means the service could not complete the request; retry once, and if it repeats report the request id. A read is safe to repeat; a write that failed this way should be re-read before it is sent again. |