Update a service-level objective in Dynatrace with the SLO API by ID, using optimistic locking and the updated SLO fields.
| PUT | SaaS | https://{your-environment-id}.apps.dynatrace.com/platform/slo/v1/slos/{id} |
You provide the service-level objective ID in the path and the optimistic-locking-version query parameter to update safely. The request body can include name, description, sliReference, customSli, criteria, tags, and externalId, and the response returns the updated SLO.
To execute this request, you need a platform token or OAuth access token with slo:slos:write scope. To learn how to obtain and use it, see Tokens and authentication.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| id | string | service-level objective ID | path | Required |
| optimistic-locking-version | string | The version of the object for optimistic locking. You can use it to detect simultaneous modifications by different users. It's generated upon retrieval (GET requests). If set on update (PUT request) or deletion, the update/deletion will be allowed only if there wasn't any change between the retrieval and the update. | query | Required |
| body | Slo | Configuration for a service-level objective. Exactly one of | body | Required |
SloConfig objectConfiguration for a service-level objective. Exactly one of sliReference or customSli must be provided. Providing both or neither results in a 400 Bad Request.
| Element | Type | Description | Required |
|---|---|---|---|
| name | string | - | Required |
| description | string | - | Optional |
| sliReference | Sli | - | Optional |
| customSli | Custom | - | Optional |
| criteria | Criteria[] | - | Required |
| tags | string[] | A list of tags for this SLO. Tags can be plain strings (e.g. | Optional |
| externalId | string | An optional user-provided external identifier for the SLO. Must be unique across all SLOs. | Optional |
SliReference object| Element | Type | Description | Required |
|---|---|---|---|
| templateId | string | The | Required |
| variables | Sli | - | Required |
SliReferenceVariable object| Element | Type | Description | Required |
|---|---|---|---|
| name | string | - | Required |
| value | string | - | Required |
CustomSli object| Element | Type | Description | Required |
|---|---|---|---|
| indicator | string | - | Required |
| filterSegments | Filter | Represents a collection of filter segments. | Optional |
FilterSegments objectRepresents a collection of filter segments.
FilterSegment objectA filter segment is identified by an ID.
| Element | Type | Description | Required |
|---|---|---|---|
| id | string | The identifier of the filter segment. | Required |
| variables | Filter | - | Optional |
FilterSegmentVariable objectDefines a variable with a name and a list of values.
| Element | Type | Description | Required |
|---|---|---|---|
| name | string | The name of the variable. | Required |
| values | string[] | The list of values for this variable. | Required |
Criteria objectTimeframe object| Element | Type | Description | Required |
|---|---|---|---|
| timeframeFrom | string | The start of the timeframe. Supports relative time expressions (e.g. | Required |
| timeframeTo | string | The end of the timeframe. Supports relative time expressions (e.g. | Optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"name": "New SLO","description": "This is a description","sliReference": {"templateId": "string","variables": [{"name": "hostIds","value": "\"HOST-123456789ABCDEFG\""}]},"customSli": {"indicator": "timeseries sli=avg(dt.host.cpu.idle)","filterSegments": [{"id": "Frbo6TNENSC","variables": [{"name": "environment","values": ["production"]},{"name": "region","values": ["us-east-1","eu-west-1"]}]}]},"criteria": [{"target": 99.8,"warning": 99.9}],"tags": ["Stage:DEV"],"externalId": "string"}
| Code | Description |
|---|---|
| 200 | Updated |
| 400 | - |
| 401 | - |
| 403 | - |
| 404 | - |
| 409 | - |
| 429 | - |
| 5XX | - |