跳转到内容
EN

List segments

Code Mode: praxis.devops.projects.segments.list

HTTP: GET /devops/v1/projects/{project}/segments

List the segments one environment of a project holds — the named groups of recipients a flag’s rules can target there. environment is required because a segment never crosses environments: an audience needed in two environments is created in each, so the same key can hold different members per environment. The first page answers totalSize and a later page does not; orderBy accepts createTime, updateTime, key and name.

签名

praxis.devops.projects.segments.list(args:{path:{/** e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string};query:{/** e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment:string;/** e.g. 20 */ pageSize?:number;/** e.g. "pt1.eyJvIjoyMH0" */ pageToken?:string;/** e.g. "createTime desc" */ orderBy?:string}}):Promise<{/** The segments on this page. */ items:Array<{/** Segment identifier used by updates; rules target a segment by its key, not by this id. e.g. "seg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always segment. */ object:"segment";/** RFC 3339 UTC time the segment was created; it is the default order of the segment list. e.g. "2026-11-03T09:10:00Z" */ createTime:string;/** RFC 3339 UTC time the segment's membership or name last changed. e.g. "2026-11-03T09:14:00Z" */ updateTime:string;/** Canonical Console link for the project this segment belongs to. e.g. "https://console.deepraxis.com/devops/projects/dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this segment belongs to, from the project list. e.g. "dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ project:string;/** The environment this segment belongs to; a segment never crosses environments, so the same audience is created once per environment it is needed in. e.g. "dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ environment:string;/** The name flag rules match this segment by; unique inside the environment, unchanged after creation, and what an inSegment clause carries. pattern: ^[a-z][a-z0-9-]{0,63}$ e.g. "beta-testers" */ key:string;/** Display name of the segment, shown wherever it is listed; it defaults to the key. e.g. "Beta testers" */ name:string;/** What the listed recipients are, such as a user or an organization; it says which context attribute the entries are compared against. e.g. "user" */ kind:string;/** Recipients always in the segment, whatever their context says; an empty list adds nobody by name. */ included:Array<string>;/** Recipients always out of the segment, even when a rule would select them; exclusion wins over inclusion. */ excluded:Array<string>;/** Rules that add recipients by a context attribute, such as everyone in a region; an empty list means membership is only the lists above. */ rules:Array<{/** The conditions this rule tests, all of which must match; an empty list matches every caller. */ clauses:Array<{/** The context kind the attribute belongs to, absent when the attribute is read from the caller's own context. e.g. "organization" */ kind?:string;/** Which context attribute is tested; it must be one of the project's declared attributes for that kind, or the configuration is refused. e.g. "region" */ attribute:string;/** How the attribute is compared; the operators that need one value, such as startsWith, use the first entry of values. e.g. "in" */ op:"in"|"notIn"|"startsWith"|"endsWith"|"contains"|"matches"|"lessThan"|"greaterThan"|"semVerLessThan"|"semVerGreaterThan"|"before"|"after"|"inSegment";/** The values this comparison uses; their type must match the attribute's declared type, and a mismatch is refused rather than evaluated as false. e.g. ["apac","eu"] */ values:Array<unknown>;/** Whether the result of the comparison is inverted; true serves the rule's variation when the comparison does not match. e.g. false */ negate?:boolean}>;rollout?:{/** Which context attribute is bucketed, such as targetingKey; bucketing by a stable attribute is what keeps one caller on one side. e.g. "targetingKey" */ bucketBy:string;/** The number that salts the bucketing; two splits with different seeds place the same caller differently, which is how a split is reset. e.g. 428173911 */ seed:number;/** Variation id to weight, out of 100000; the weights must total exactly 100000 or the write is refused with ROLLOUT_WEIGHTS_INVALID. e.g. {"on":50000,"off":50000} */ weights:{[key:string]: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;/** How many segments the environment holds in total; present on the first page only, because a counted total costs a second query a later page does not repeat. e.g. 12 */ totalSize?:number}>;

参数

名称位置类型必填说明
projectpathstring是Identifies the project whose data you are reading, from the project list or create answer.
environmentquerystring是Identifies the environment whose segments you are reading, from the project’s environment list; a segment belongs to exactly one environment, so this is required rather than a filter.
pageSizequerynumber否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.
pageTokenquerystring否The cursor from the previous page’s nextPageToken. Treat it as opaque and never build one yourself; omit it for the first page.
orderByquerystring否Comma-separated fields to order by, each optionally suffixed with desc, for example createTime desc. Only the fields the resource declares are accepted; anything else is refused so an ordering typo cannot silently return a different order. Omitted uses the resource’s own order.

响应

状态码内容类型说明
200application/jsonOne page of that environment’s segments.
400application/jsonINVALID_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.
401application/jsonThe API key is missing or invalid; send a valid Praxis API key in the Authorization header before retrying.
403application/jsonThe 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.
404application/jsonENVIRONMENT_NOT_FOUND means no environment with that id exists in this organization, or it belongs to another project; list the project’s environments and use an id from that answer.
500application/jsonINTERNAL 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.