Skip to main content

Grail resource store API

  • Reference

Documentation of the Dynatrace Resource Store API for Grail. To read about use cases and examples, see Dynatrace Documentation

Version 1
npm install @dynatrace-sdk/client-resource-store

lookupDataClient​

import { lookupDataClient } from '@dynatrace-sdk/client-resource-store';

delete​

lookupDataClient.delete(config): Promise<void>

Delete file.

Required scope: storage:files:delete

Delete file

Delete a file from the Grail Resource Store.

ATTENTION - This operation is irreversible.

The request body needs to contain the request parameters (see below) in JSON format.

Request parameters

  • filePath (required) - The fully qualified file path of the file. Example: * /lookups/mydata*.

Permissions

Required permissions: storage:files:delete

Parameters​

NameType
config.body*requiredResourceDeleteRequest

Returns​

Return typeStatus codeDescription
void204The requested file has been deleted successfully.

Throws​

Error TypeError Message
ErrorEnvelopeErrorBad request for deleting the file. | Unauthorized. | Access forbidden. | The file does not exist. | Internal Server Error | Client Error | Server Error

Code example

import { lookupDataClient } from "@dynatrace-sdk/client-resource-store";

const data = await lookupDataClient.delete({
body: { filePath: "/lookups/mydata" },
});

upload​

lookupDataClient.upload(config): Promise<ResourceUploadResponse>

Upload lookup data

Required scope: storage:files:write

Upload lookup data

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:

  • request: containing the request parameters (see below) in JSON format
  • content: containing the lookup data in text format

The uploaded data is parsed using the Dynatrace Pattern Language (DPL). For examples, see the Dynatrace Documentation.

Request parameters

  • 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:
    • must only contain alphanumeric characters [a-zA-Z0-9], -, _, ., /
    • must start with /lookups
    • must end with [a-zA-Z0-9]
    • must contain at least two / characters
    • between any two consecutive / characters there must be at least one [a-zA-Z0-9] character
    • can be up to 500 characters long
  • overwrite - 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.

Permissions

Required permissions: storage:files:write

Parameters​

NameType
config.body*requiredResourceUploadRequestEnvelope

Returns​

Return typeStatus codeDescription
ResourceUploadResponse200The requested table has been saved successfully.

Throws​

Error TypeError Message
ErrorEnvelopeErrorBad request for uploading the lookup data. | Unauthorized. | Access forbidden. | Conflict because the requested table already exists and override parameter was set to false. | The uploaded file or the JSON request were too large. | Too many concurrent requests. | Internal Server Error | Client Error | Server Error

Code example

import { lookupDataClient } from "@dynatrace-sdk/client-resource-store";

const data = await lookupDataClient.upload({
body: {
content: "...",
request: {
filePath: "/lookups/mydata",
lookupField: "id",
parsePattern: "LD:id ',' LD:value",
},
},
});

uploadToTestPattern​

lookupDataClient.uploadToTestPattern(config): Promise<ResourceTestPatternResponse>

Test parsing lookup data without storing the result in the Grail Resource Store.

Required scope: storage:files:write

Test parsing lookup data

Test parsing lookup data without storing the result in the Grail Resource Store. The request body needs to be submitted as multipart/form-data with the following parts:

  • request: containing the request parameters (see below) in JSON format
  • content: containing the lookup data in text format

The uploaded data is parsed using the Dynatrace Pattern Language (DPL). For examples, see the Dynatrace Documentation.

Request parameters

  • 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 - 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

Permissions

Required permissions: storage:files:write

Parameters​

NameType
config.body*requiredResourceTestPatternRequestEnvelope

Returns​

Return typeStatus codeDescription
ResourceTestPatternResponse200The result of applying the pattern to the uploaded file. The schema for the records and types is the same as in the DQL Query API.

Throws​

Error TypeError Message
ErrorEnvelopeErrorBad request for uploading the lookup data. | Unauthorized. | Access forbidden. | The uploaded file or the JSON request were too large. | Too many concurrent requests. | Internal Server Error | Client Error | Server Error

Code example

import { lookupDataClient } from "@dynatrace-sdk/client-resource-store";

const data = await lookupDataClient.uploadToTestPattern({
body: {
content: "...",
request: { parsePattern: "LD:id ',' LD:value" },
},
});

Types​

CustomValidationErrorInfo​

NameType
message*requiredstring

ErrorEnvelope​

NameType
errorExceptionalReturn

ErrorInfo​

NameType
message*requiredstring

ExceptionalReturn​

NameType
codenumber
errorDetails*requiredArray<CustomValidationErrorInfo | InvalidAuditEventsErrorInfo | MediaTypeErrorInfo | ParameterErrorInfo | ProxyErrorInfo | QueryFrontendRawErrorInfo | RequestBodyErrorInfo>
message*requiredstring

InvalidAuditEventsErrorInfo​

NameType
invalidAuditEventIndices*requiredArray<number>
invalidEventIndicesArray<number>
message*requiredstring

MediaTypeErrorInfo​

NameType
message*requiredstring
supportedMediaTypes*requiredArray<string>

ParameterErrorInfo​

NameType
message*requiredstring
parameterDescriptor*requiredstring

ProxyErrorInfo​

NameType
message*requiredstring

QueryFrontendRawErrorInfo​

NameType
message*requiredstring
rawQueryFrontendResponse*requiredstring

RequestBodyErrorInfo​

NameType
bodyDescriptor*requiredstring
message*requiredstring

ResourceDeleteRequest​

Request Details

NameTypeDescription
filePath*requiredstringThe fully qualified file path of the tabular file to store the lookup data in Grail.

Example: /lookups/mydata

ResourceTestPatternRequest​

The JSON metadata for the test pattern request.

NameTypeDescription
autoFlattenbooleanSet to true to extract nested fields to the root level when the specified DPL pattern results in a single record-type field.

Default: true
localestringThe 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
lookupFieldstringThe 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.

Example: id
parsePattern*requiredstringThe DPL pattern to parse the uploaded data. Every pattern match produces a record.

Example: LD:id ',' LD:value
skippedRecordsnumberThe number of initial records to discard. Can be used to skip header rows.

Default: 0
timezonestringThe timezone for parsing time and date fields. The list of valid input values matches that of the IANA Time Zone Database (TZDB).

Example: UTC

ResourceTestPatternRequestEnvelope​

Multipart request containing JSON metadata and file content.

NameTypeDescription
content*requiredBinary
request*requiredResourceTestPatternRequestThe JSON metadata for the test pattern request.

ResourceTestPatternResponse​

The result of applying the pattern to the uploaded file.

NameTypeDescription
numberOfRecordsnumberThe total number of records in the uploaded file that match the provided pattern.

Example: 1000000
recordsArray<ResourceTestPatternResponseRecordsItem>List of records that result from applying the pattern to the uploaded file. If there are more than 100 records, this list contains only the first 100.
typesArray<ResourceTestPatternResponseTypesItem>The data types for the result records.

ResourceTestPatternResponseRecordsItem​

List of records that result from applying the pattern to the uploaded file. If there are more than 100 records, this list contains only the first 100.

type: Record<string, Record<string, any>>

ResourceTestPatternResponseTypesItem​

The data types for the result records.

type: Record<string, Record<string, any>>

ResourceUploadRequest​

The JSON metadata for the upload request.

NameTypeDescription
autoFlattenbooleanSet to true to extract nested fields to the root level when the specified DPL pattern results in a single record-type field.

Default: true
descriptionstringAn optional description for the file.

Example: Description of my lookup data
displayNamestringAn optional name for the file.

Example: My lookup data
dt.cost.costcenterstringCan be used to assign usage to a Cost Center.
dt.cost.productstringCan be used to assign usage to a Product or Application Id.
filePath*requiredstringThe fully qualified file path of the tabular file to store the lookup data in Grail.

Example: /lookups/mydata
localestringThe 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
lookupField*requiredstringThe 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.

Example: id
overwritebooleanIf false and the file already exists, the upload fails. Set to true to allow overwriting existing files.

Default: false
parsePattern*requiredstringThe DPL pattern to parse the uploaded data. Every pattern match produces a record.

Example: LD:id ',' LD:value
skippedRecordsnumberThe number of initial records to discard. Can be used to skip header rows.

Default: 0
timezonestringThe timezone for parsing time and date fields. The list of valid input values matches that of the IANA Time Zone Database (TZDB).

Example: UTC

ResourceUploadRequestEnvelope​

Multipart request containing JSON metadata and file content.

NameTypeDescription
content*requiredBinary
request*requiredResourceUploadRequestThe JSON metadata for the upload request.

ResourceUploadResponse​

NameTypeDescription
discardedDuplicates*requirednumberThe number of records that were discarded because their lookup field was not unique.
fileSize*requirednumberThe size of the tabular file in the resource store, in bytes.
patternMatches*requirednumberThe number of records in the uploaded file that match the parse pattern.
records*requirednumberThe number of records in the final lookup data.
skippedRecords*requirednumberThe number of records that were skipped, based on the skippedRecords parameter in the request.
uploadedBytes*requirednumberThe number of bytes that were sent in the request content.
Still have questions?
Find answers in the Dynatrace Community