Conditional updates
Use the resource version from a read to avoid overwriting another client's changes. Conditional version checks apply to PATCH and DELETE, not POST.
Note: Balancer is in beta. Endpoints, fields and behavior may change before general availability, and the feature must be enabled on your account before use. Contact your NetActuate account manager to request access.
Version controls
| Control | Behavior |
|---|---|
If-Match header | Supplies the expected version. Takes precedence over ifVersion when both are present. |
ifVersion argument | Optional integer from 0 to 9007199254740991; integer strings are normalized. |
version response field | Resource version to use for your next conditional change. |
| HTTP 412 | The supplied version differs from the transaction-locked version, or the checked resource disappeared. |
Version checks cover the operation's primary resource or parent, not every referenced object. Use the version associated with that operation. POST actions do not honor these controls.
Update an HTTP load balancer
Set BALANCER_API_BASE to https://<your-api-host>, using the host shown in the Balancer portal. Use an account API key with write access and jq. Set BALANCER_HTTP_LB_ID to a load balancer you can edit.
-
Read its current configuration and version.
curl --silent --show-error \
"$BALANCER_API_BASE/http-loadbalancers/$BALANCER_HTTP_LB_ID" \
-H "x-api-key: $BALANCER_API_KEY" > before.json
BALANCER_VERSION=$(jq -r '.data.version' before.json)
cat before.jsonExpect HTTP 200 with
data.httpLbIdanddata.version. Verify the identifier before editing. -
Submit your change with that version.
curl --silent --show-error -i -X PATCH \
"$BALANCER_API_BASE/http-loadbalancers/$BALANCER_HTTP_LB_ID" \
-H "x-api-key: $BALANCER_API_KEY" \
-H "If-Match: $BALANCER_VERSION" \
-H 'Content-Type: application/json' \
--data '{"description":"Updated application configuration"}'Expect HTTP 200 with
data.httpLbIdif the version still matches. For example, if your read returns version 7 and another client changes it to 8 before this request, a request withIf-Match: 7returns 412.To use the body argument instead, omit
If-Matchand construct the body withjq -n --argjson version "$BALANCER_VERSION" '{ifVersion:$version,description:"Updated application configuration"}'. Send that JSON as the PATCH body. -
Read the resource again with the command from step 1. Verify the saved description and use the returned version for your next edit. After 412, compare the latest data with your earlier copy, reconcile the intended edit and repeat step 2 with the new version. Do not merely replace the version and resend an obsolete change.