Skip to content

Variant routes: update, delete

The Variant Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for Variant, one group of Variant routes.

Variant.update

Changes the given properties of a Variant. Verb page.

Text
PATCH /{namespace}/variants/{id}

Path: id. Body, as JSON: the other inputs. Emits Variant.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Variant.
keystringThe name the Flag returns for it.
valuejsonWhat it changes: copy, behavior, a definition Version, or a Thing.
controlbooleanTrue for the current definition every challenger is judged against.
followsVariantThe Variant it was drafted from by a learn step.

Returns

OutputTypeRequiredDescription
variantVariantrequiredThe Variant.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X PATCH https://api.sb/leaseline.app/variants/variant_nvdfmt7dTw \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":{}}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "variant": {
    "$id": "https://api.sb/leaseline.app/variants/variant_nvdfmt7dTw",
    "$type": "Variant",
    "key": "Example key",
    "value": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Variant.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}

Variant.delete

Deletes a Variant: a soft delete that keeps its history, undone by Thing.restore. Verb page.

Text
DELETE /{namespace}/variants/{id}

Path: id. Emits Variant.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Variant.

Returns

OutputTypeRequiredDescription
variantVariantrequiredThe Variant.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X DELETE https://api.sb/leaseline.app/variants/variant_nvdfmt7dTw \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
JSON
{
  "api": "https://api.sb/leaseline.app",
  "variant": {
    "$id": "https://api.sb/leaseline.app/variants/variant_nvdfmt7dTw",
    "$type": "Variant",
    "key": "Example key",
    "value": {}
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Variant.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}