Upload lookup data in Dynatrace with the Grail Resource Store API and save or replace a tabular file after parsing the content with DPL.
| POST | SaaS | https://{your-environment-id}.apps.dynatrace.com/v1/files/tabular/lookup:upload |
Upload lookup data and store it as a new tabular file in the Grail Resource Store or replace an existing one.
The request body needs to be submitted as multipart/form-data with the following parts:
The uploaded data is parsed using the Dynatrace Pattern Language (DPL). For examples, see the Dynatrace Documentation.
filePath (required) - The fully qualified file path of the tabular file to store the
lookup
data in Grail. Example: /lookups/mydata. The following constraints apply:
[a-zA-Z0-9], -, _, ., //lookups[a-zA-Z0-9]/ characters/ characters there must be at least one [a-zA-Z0-9] characteroverwrite - If false and the file already exists, the upload fails. Set to true to allow
overwriting existing files. Default: false
displayName - An optional name for the file. The length is limited to 500 characters.
description - An optional description for the file. The length is limited to 500 characters.
parsePattern (required) - The DPL pattern to parse the uploaded data. Every pattern match
produces a record. Example: LD:id ',' LD:value.
skippedRecords - The number of initial records to discard. Can be used to skip header rows.
Default: 0
lookupField (required) - The name of the lookup field whose value identifies a record in
the lookup data. The uniqueness of the values is ensured by deduplicating records during
upload, if necessary.
timezone - The timezone for parsing time and date fields. The list of valid input values
matches that of the IANA Time Zone Database (TZDB). Example: UTC.
locale - The locale for parsing locale-specific day and month names. The input values take the
ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore.
Example: en_US.
autoFlatten - Set to true to extract nested fields to the root level when the specified DPL
pattern results in a single record-type field. Default: true
dt.cost.costcenter - Can be used to assign usage to a Cost Center.
dt.cost.product - Can be used to assign usage to a Product or Application Id.
To execute this request, you need a platform token or OAuth access token with storage:files:write scope. To learn how to obtain and use it, see Tokens and authentication.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| body | Resource | Multipart request containing JSON metadata and file content. | body | Optional |
ResourceUploadRequestEnvelope objectMultipart request containing JSON metadata and file content.
| Element | Type | Description | Required |
|---|---|---|---|
| content | string | - | Required |
| request | Resource | The JSON metadata for the upload request. | Required |
ResourceUploadRequest objectThe JSON metadata for the upload request.
| Element | Type | Description | Required |
|---|---|---|---|
| autoFlatten | boolean | Set to true to extract nested fields to the root level when the specified DPL pattern results in a single record-type field. | Optional |
| description | string | An optional description for the file. | Optional |
| displayName | string | An optional name for the file. | Optional |
| dt.cost.costcenter | string | Can be used to assign usage to a Cost Center. | Optional |
| dt.cost.product | string | Can be used to assign usage to a Product or Application Id. | Optional |
| filePath | string | The fully qualified file path of the tabular file to store the lookup data in Grail. | Required |
| locale | string | The locale for parsing locale-specific day and month names. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. | Optional |
| lookupField | string | The name of the lookup field whose value identifies a record in the lookup data.The uniqueness of the values is ensured by deduplicating records during upload, if necessary. | Required |
| overwrite | boolean | If false and the file already exists, the upload fails. Set to true to allow overwriting existing files. | Optional |
| parsePattern | string | The DPL pattern to parse the uploaded data. Every pattern match produces a record. | Required |
| skippedRecords | integer | The number of initial records to discard. Can be used to skip header rows. | Optional |
| timezone | string | The timezone for parsing time and date fields. The list of valid input values matches that of the IANA Time Zone Database (TZDB). | Optional |
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"content": "string","request": {"autoFlatten": true,"description": "Description of my lookup data","displayName": "My lookup data","dt.cost.costcenter": "string","dt.cost.product": "string","filePath": "/lookups/mydata","locale": "en_US","lookupField": "id","overwrite": false,"parsePattern": "LD:id ',' LD:value","skippedRecords": 0,"timezone": "UTC"}}
| Code | Type | Description |
|---|---|---|
| 200 | Resource | The requested table has been saved successfully. |
| 400 | Error | Bad request for uploading the lookup data. |
| 401 | Error | Unauthorized. |
| 403 | Error | Access forbidden. |
| 409 | Error | Conflict because the requested table already exists and |
| 413 | Error | The uploaded file or the JSON request were too large. |
| 429 | Error | Too many concurrent requests. |
| 500 | Error | Internal Server Error |
| 4XX | Error | Client Error |
| 5XX | Error | Server Error |
ResourceUploadResponse object| Element | Type | Description |
|---|---|---|
| discardedDuplicates | integer | The number of records that were discarded because their lookup field was not unique. |
| fileSize | integer | The size of the tabular file in the resource store, in bytes. |
| patternMatches | integer | The number of records in the uploaded file that match the parse pattern. |
| records | integer | The number of records in the final lookup data. |
| skippedRecords | integer | The number of records that were skipped, based on the skippedRecords parameter in the request. |
| uploadedBytes | integer | The number of bytes that were sent in the request content. |
ErrorEnvelope object| Element | Type | Description |
|---|---|---|
| error | Exceptional | - |
ExceptionalReturn object| Element | Type | Description |
|---|---|---|
| code | integer | - |
| errorDetails | (Custom | - |
| message | string | - |
CustomValidationErrorInfo objectErrorInfo object| Element | Type | Description |
|---|---|---|
| message | string | - |
InvalidAuditEventsErrorInfo objectMediaTypeErrorInfo objectParameterErrorInfo objectProxyErrorInfo objectQueryFrontendRawErrorInfo objectRequestBodyErrorInfo object{"fileSize": 1024,"uploadedBytes": 2028,"patternMatches": 120,"skippedRecords": 5,"discardedDuplicates": 20,"records": 95}
{"error": {"code": 400,"message": "Upload failed: Parse pattern must not be blank."}}