Set or clear a repository's guidance
const url = 'https://zkao.io/api/v1/projects/example/repositories/example/guidance';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"content":"example","expectedContent":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://zkao.io/api/v1/projects/example/repositories/example/guidance \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "content": "example", "expectedContent": "example" }'Requires scope: guidance:write. Sets content as the repository’s guidance (or clears it with null), recording a revision. Writing the same content that is already stored is a no-op (unchanged: true, no revision). Pass expectedContent for an optimistic compare-and-set: omit it for last-writer-wins, or send the content you last read (or null for “currently cleared”) to get a 409 instead of clobbering a concurrent change.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
New guidance content; null clears it.
Optional compare-and-set. Omit for last-writer-wins. Send the content you last read (or null for “currently cleared”) to receive a 409 if the guidance changed underneath you instead of overwriting it.
Examplegenerated
{ "content": "example", "expectedContent": "example"}Responses
Section titled “ Responses ”OK
object
The recorded revision id, or null on a no-op write.
True when the content already matched (no revision recorded).
Examplegenerated
{ "repositoryId": "example", "revisionId": "example", "unchanged": true}Invalid request
object
object
Example
{ "error": { "code": "unauthorized" }}Missing, malformed, expired, or revoked token
object
object
Example
{ "error": { "code": "unauthorized" }}The token lacks the required scope
object
object
Example
{ "error": { "code": "unauthorized" }}Resource not in this token’s project or repo allowlist
object
object
Example
{ "error": { "code": "unauthorized" }}A compare-and-set (expectedContent) missed: the guidance changed since it was read. Re-read the current guidance and retry.
object
object
Example
{ "error": { "code": "unauthorized" }}
