package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.elefork.com/v1/branches/example"
payload := strings.NewReader("{ \"pause_policy\": \"idle\" }")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.elefork.com/v1/branches/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"pause_policy":"idle"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.elefork.com/v1/branches/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "pause_policy": "idle" }'Change a branch’s settings. Today only pause_policy: idle pauses the branch after the
platform’s idle timeout without connections, never keeps it running until it is paused
through the API. Takes effect at once, in any state; omitted fields are left unchanged.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
idle: paused automatically after the idle timeout without connections (woken on the next
connection). never: never paused automatically; POST /v1/branches/{id}/pause still works.
Responses
Section titled “Responses”Updated branch
object
L0: reset to the last checkpoint after a crash. L1: async WAL replication. L2: no confirmed commit lost if any single host is lost (L1/L2 return 501 until available).
idle: paused automatically after the idle timeout without connections (woken on the next
connection). never: never paused automatically; POST /v1/branches/{id}/pause still works.
Example
{ "durability": "L0", "pause_policy": "idle", "size": "nano", "state": "creating", "source_kind": "template"}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}Error
object
object
Example
{ "error": { "code": "not_found" }}request_in_progress: a request with this Idempotency-Key is still running; retry later
object
object
Example
{ "error": { "code": "not_found" }}idempotency_mismatch: this Idempotency-Key was used with a different request
object
object
Example
{ "error": { "code": "not_found" }}Temporarily unavailable; retry after the Retry-After seconds. Codes:
database_unavailable (the metadata database is failing over) and
cube_admission (a compute node runs a sandbox shim below the
platform minimum, so creates, forks, checkpoints and resets are
refused until it is upgraded).
object
object
Example
{ "error": { "code": "not_found" }}