Skip to content
中文

Diff two spec revisions

Code Mode: praxis.workforce.specs.retrieveDiff

HTTP: GET /workforce/v1/specs/{kind}/{id}/diff

Compares two revisions of one subject’s spec and lists the changes between them, each with its path and, for a change, the value before and after; revision 0 is the empty spec, so diffing 0 against 1 shows the first write. Read-only. Errors: 400 INVALID_PARAMS when from or to is missing or not an integer; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent; 404 when the subject does not exist, or SPEC_REVISION_NOT_FOUND when from or to was never written. Example: GET /workforce/v1/specs/job/jpr_123/diff?from=1&to=2.

Signature

praxis.workforce.specs.retrieveDiff(args:{path:{kind:"organization"|"department"|"level"|"job"|"position"|"assignment";id:string};query:{from:number;to:number}}):Promise<{kind:"organization"|"department"|"level"|"job"|"position"|"assignment";/** The subject's own id (org_..., dept_..., lvl_..., jpr_..., pos_... */ id:string;/** The earlier revision that was compared from; 0 is the empty spec before the first write. */ from:number;/** The later revision that was compared to. */ to:number;/** The differences found, in path order. */ changes:Array<{/** Full path of the changed value inside the envelope, such as spec.document, spec.provision.agent.model or spec.provision.repositories[github:org/repo]. */ path:string;/** What happened at this path between the two revisions. */ op:"added"|"removed"|"changed";/** The value at this path in the earlier revision, verbatim; absent when the value was added. */ before?:unknown;/** The value at this path in the later revision, verbatim; absent when the value was removed. */ after?:unknown}>}>;

Parameters

NameInTypeRequiredDescription
kindpath“organization” | “department” | “level” | “job” | “position” | “assignment”yesKind of the subject whose revisions to compare.
idpathstringyesThe subject’s own id (org_…, dept_…, lvl_…, jpr_…, pos_… or asg_…).
fromquerynumberyesThe earlier revision to compare from; 0 is the empty spec before the first write.
toquerynumberyesThe later revision to compare to.

Responses

StatusContent typesDescription
200application/jsonThe changes between the two revisions, in path order.
400application/problem+jsonINVALID_PARAMS; from or to is missing or not an integer. Send both as whole numbers.
401Missing or invalid credential; provide a valid organization API key or sign in to the Console.
403application/problem+jsonPERMISSION_DENIED; a run or computer token, or a session token that names no agent, is refused. Call with an organization API key, a Console session, or the agent’s own session token.
404application/problem+jsonThe subject is not in your organization, or from or to has no stored revision (SPEC_REVISION_NOT_FOUND). List the revision history and copy a revision it returns.