跳转到内容
EN

Update a flag

Code Mode: praxis.devops.flags.update

HTTP: PATCH /devops/v1/flags/{id}

Change a flag’s metadata — its name, description, owner, observation deadline, removal ticket or tags — without touching what any environment serves. Send the fields to change inside flag and name them in updateMask; a field present in flag but absent from the mask is left alone, and a mask naming a field this operation cannot change is refused rather than ignored. Sending null clears a nullable field such as observeUntil. Served values are not changed here: use the environment update for what an environment serves, which is versioned and checked. An archived flag cannot be updated.

签名

praxis.devops.flags.update(args:{path:{/** e.g. "flg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string};body:{flag:{/** New display name for the flag; nothing depends on it, so it may change freely. e.g. "Sandbox defaults to an ephemeral instance" */ name?:string;/** New description of what the flag does; send null to clear it and leave the flag without one. e.g. "New sandboxes start ephemeral unless the caller asks for a persistent one." */ description?:string;owner?:{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string};/** New observation deadline, or null to clear it; a cleared deadline on a release or experiment flag leaves it without the date it is required to carry. e.g. "2026-12-31T23:59:59Z" */ observeUntil?:string;/** New removal ticket for the flag; send null to clear it, which loses the link to the work that retires the flag. e.g. "#279" */ removalTicket?:string;/** The flag's tags, replacing the whole set rather than adding to it; send an empty list to remove them all. */ tags?:Array<string>};/** Which fields to write, by name; omit it to write every field the flag object carries. e.g. ["observeUntil","owner"] */ updateMask?:Array<string>}}):Promise<{/** Flag identifier used by every later read and write of this flag; code names the flag by key, while this API addresses it by id. e.g. "flg_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** The resource type of this answer, always flag. */ object:"flag";/** RFC 3339 UTC time the flag was created; the flag list is ordered by it, newest first. e.g. "2026-10-27T02:00:00Z" */ createTime:string;/** RFC 3339 UTC time the flag's own fields last changed; a change to one environment's configuration does not move this. e.g. "2026-11-02T08:12:00Z" */ updateTime:string;/** Canonical Console link for the project this flag belongs to. e.g. "https://console.deepraxis.com/devops/projects/dvp_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ viewerUrl:string;/** The project this flag belongs to, from the project list. e.g. "dvp_01m6j8swzteapw2j5sh4" */ project:string;/** The name code calls this flag by, unique inside the project including archived flags; it is what a ruleset and a client library look up. e.g. "sandbox-ephemeral-default" */ key:string;/** Display name of the flag, shown wherever it is listed; it may change freely and nothing depends on it. e.g. "Sandbox defaults to an ephemeral instance" */ name:string;/** What this flag does to the product, absent when none was given; it is where the reason for the flag belongs. e.g. "New sandboxes start ephemeral unless the caller asks for a persistent one." */ description?:string;/** What sort of flag this is, which decides how long it may live and what its removal means. e.g. "release" */ kind:"release"|"experiment"|"ops"|"permission";/** The type every variation of this flag has; a value of another type cannot be served, and clients request the flag in this type. e.g. "boolean" */ valueType:"boolean"|"string"|"number"|"object";/** The values this flag can serve, each with the id that rules and defaults refer to. */ variations:Array<{/** Variation id, which is what a default, a rule and a rollout name; it is a name, not the value itself. e.g. "on" */ id:string;/** The value served when this variation is selected; its type is the flag's valueType. e.g. true */ value:unknown;/** Human-readable name for this variation, absent when only an id was given. e.g. "On" */ name?:string}>;defaults:{/** Variation served to a caller that matches no rule while the flag is on; it must name one of the flag's variations. e.g. "on" */ onVariation:string;/** Variation served while the flag is off, whatever the rules say; this is the value an incident falls back to. e.g. "off" */ offVariation:string};/** Who owns this flag and is expected to conclude it when its observation deadline arrives; null when the flag was created without one. */ owner:null|{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string};/** RFC 3339 UTC time this flag must be decided by, required for a release or experiment flag; absent for a flag that has no deadline. e.g. "2026-12-15T23:59:59Z" */ observeUntil?:string;/** The ticket that removes the flag and its code once the rollout is complete, absent when none was recorded. e.g. "#279" */ removalTicket?:string;origin:{/** Which path created the flag; exposure means a change declared it and carried it here, manual means someone created it directly. e.g. "manual" */ declaredBy:"exposure"|"manual";/** The pull request that declared this flag, present only when declaredBy is exposure; it is what ties the flag to the change that introduced it. e.g. "pr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ pullRequest?:string};/** Where the flag is in its own life; launched means the behaviour is permanent and only the code and the flag row remain to be removed. e.g. "active" */ lifecycle:"new"|"active"|"launched"|"inactive"|"archived";/** Whether the flag looks abandoned: its deadline has passed or no environment has used it. e.g. false */ stale:boolean;/** What each environment of the project serves for this flag, keyed by environment id; every environment has an entry from the moment the flag is created. e.g. {"dve_01JQ8Z3M9K4V7B2N6C5X0YTRHW":{"on":true,"version":3}} */ environments:{[key:string]:{/** Whether the flag is evaluated at all here; false serves the off variation to everyone and makes the rules and the rollout below irrelevant. e.g. true */ on:boolean;/** Other flags this one depends on: it is evaluated only when each of them serves the variation named here. */ prerequisites:Array<{/** The key of the prerequisite flag, which is how code and the evaluator name it. e.g. "sandbox-ephemeral-default" */ flagKey:string;/** The variation the prerequisite must serve; when it serves anything else this flag is not evaluated and its off variation is served. e.g. "on" */ variation:string}>;/** Callers named individually, grouped by context kind, and the variation each group gets; a named caller is served before any rule is evaluated. */ targets:Array<{/** The context kind these keys belong to, such as user or organization; the same key string can name different things in different kinds. e.g. "user" */ kind:string;/** The variation every caller in this group is served, whatever the rules would have decided. e.g. "on" */ variation:string;/** The targeting keys in this group; a caller whose targetingKey is listed here is served this variation. */ keys:Array<string>}>;/** The targeting rules, evaluated in order; the first rule whose clauses all match decides the variation, and an empty list means every caller falls through. */ rules:Array<{/** Rule identifier, used when a rule is updated or removed by a configuration write. e.g. "rule-1" */ id:string;/** What this rule is for, in the author's words; absent when none was given, which makes a rule hard to judge later. e.g. "Internal users get the new path first." */ description?:string;/** 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}>;serve:{/** The variation to serve; it must name one of the flag's variations. e.g. "on" */ variation:string}|{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}}};/** Whether the rule is skipped; true keeps the rule in place without letting it decide anything. e.g. false */ disabled?:boolean}>;fallthrough:{/** The variation to serve; it must name one of the flag's variations. e.g. "on" */ variation:string}|{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}}};/** The progressive rollout currently ramping this environment, absent when the environment serves its fallthrough directly. e.g. "prr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ progressiveRollout?:string;/** The configuration version, incremented by each accepted write; send the version you read so a concurrent edit is refused rather than overwritten. e.g. 3 */ version:number;/** RFC 3339 UTC time this environment's configuration last changed. e.g. "2026-11-02T08:12:00Z" */ updateTime:string;updatedBy:{/** What sort of actor this is, which decides how the id should be read. e.g. "user" */ kind:"user"|"agent"|"system";/** Identifier of the actor within its kind, such as a user id for a person. e.g. "usr_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ id:string;/** Display name for the actor at the time, so a record reads the way it did when it was written; absent when none was known. e.g. "Sean" */ label?:string}}};codeRefs:{/** How many places the scan found the flag key read at the scanned commit; zero means no code reads it. e.g. 4 */ count:number;/** The commit the scan read; an old commit means the count describes the code as it was then, not as it is now. e.g. "4f2a9c1d8e7b6a5c4d3e2f1a0b9c8d7e6f5a4b3c" */ scannedCommit:string};/** Labels on the flag for grouping and searching; empty when none were set. */ tags:Array<string>;/** Which evaluator serves this flag at runtime; it decides whether a ruleset or the local flag binding answers an evaluation. e.g. "ruleset" */ evaluator:"flagship"|"ruleset"}>;

参数

名称位置类型必填说明
idpathstring是The flag identifier from a flag list or create answer; code names a flag by its key, while this API addresses it by id.

请求体

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

响应

状态码内容类型说明
200application/jsonThe flag after the change, with its environments untouched.
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/jsonFLAG_NOT_FOUND means no flag with that id exists in this organization; list the project’s flags and use an id from that answer. An archived flag is still readable by id — it is the list that hides it.
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.