Create a fieldset in Dynatrace with the Grail Fieldsets API by sending its name, scope, fields, tables, buckets, description, and enabled state.
| POST | SaaS | https://{your-environment-id}.apps.dynatrace.com/platform/storage/fieldsets/v1/fieldsets |
You provide the fieldset details in the request body, including buckets, description, enabled, fields, name, scope, and tables. The operation returns 201 when the fieldset is successfully created.
To execute this request, you need a platform token or OAuth access token with storage:fieldset-definitions:write scope. To learn how to obtain and use it, see Tokens and authentication.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| body | New | - | body | Required |
NewFieldsetRequest object| Element | Type | Description | Required |
|---|---|---|---|
| buckets | string[] | List of the buckets on which fieldset is applicable. | Optional |
| description | string | Description of the fieldset. | Optional |
| enabled | boolean | Description of the fieldset. | Optional |
| fields | string[] | List of the fields. | Required |
| name | string | Name of the fieldset. | Required |
| scope | string | Scope of the fieldset. The element can hold these values
| Required |
| tables | string[] | List of the tables on which fieldset is applicable. | 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": "sensitive-fields-on-bucket","description": "Sensitive field set for all buckets starting with 'default_'","enabled": true,"scope": "BUCKET","fields": ["email","userid"],"buckets": ["default_*"]}
| Code | Type | Description |
|---|---|---|
| 201 | Fieldset | fieldset successfully created. |
| 400 | Error | Bad Request: the server cannot process the request due to a supposed client error. |
| 409 | Error | Conflict: A fieldset with this name already exists. |
| 5XX | Error | Server error. |
Fieldset object| Element | Type | Description |
|---|---|---|
| buckets | string[] | List of the buckets on which fieldset is applicable. |
| created | string | Timestamp in ISO-8601 indicating when the field record was created. |
| createdBy | string | Creator of the fieldset. |
| description | string | Description of the fieldset. |
| enabled | boolean | Indicates if the fieldset is enabled. |
| fields | string[] | List of the fields. |
| lastModified | string | Timestamp in ISO-8601 indicating when the field record was updated. |
| lastModifiedBy | string | Last user who modified the fieldset. |
| name | string | Name of the fieldset. |
| readOnly | boolean | Indicates if the fieldset is read only and can not be updated. |
| scope | string | Scope of the fieldset. |
| tables | string[] | List of the tables on which fieldset is applicable. |
| uid | string | Unique identifier of the fieldset. |
| version | integer | Used for optimistic locking. Update requests define with this on which version the data updated is based on. This must match with the version stored, otherwise the update will fail due to concurrent modification. |
ErrorEnvelope object| Element | Type | Description |
|---|---|---|
| error | Error | The response for error state |
ErrorResponse objectThe response for error state
| Element | Type | Description |
|---|---|---|
| code | integer | Error code, which normally matches the HTTP error code. |
| details | Error | Detailed information about the error. |
| message | string | A short, clear error message without details |
ErrorResponseDetails objectDetailed information about the error.
| Element | Type | Description |
|---|---|---|
| constraintViolations | Error | Information about an input parameter that violated some validation rule of the service API. |
| errorMessage | string | Complete error message. |
| missingPermissions | string[] | List of missing IAM permissions necessary to successfully execute the request. |
| missingScopes | string[] | List of missing IAM scopes necessary to successfully execute the request. |
ErrorResponseDetailsConstraintViolations objectInformation about an input parameter that violated some validation rule of the service API.
| Element | Type | Description |
|---|---|---|
| message | string | Message describing the error. |
| parameterDescriptor | string | Describes the violating parameter. |
{"uid": "12132","name": "sensitive-fields","description": "","createdBy": "6e6abcde-3e36-42ab-bc5c-9abcdec123a45","enabled": true,"readOnly": false,"scope": "TABLE","fields": ["email","userid"],"tables": ["spans","logs"],"version": 1,"lastModifiedBy": "6e6abcde-3e36-42ab-bc5c-9abcdec123a45","created": "2024-01-01T15:04:20.698Z","lastModified": "2024-12-31T18:06:09.647Z"}
{"error": {"message": "Constraint Violations","details": {"constraintViolations": [{"message": "size must be between 0 and 100","parameterDescriptor": "fieldsetName"}]},"code": 400}}