{"version":16,"variables":[{"key":"schema","type":"code","input":"export default async function fetchAllSchemasAndObjects() {\n const schemaBaseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/schemas?fields=schemaId';\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n let schemas = [];\n let nextPageKey = null;\n\n try {\n // Fetch all schemas\n do {\n const fetchUrl = nextPageKey ? `${schemaBaseUrl}&nextPageKey=${nextPageKey}` : schemaBaseUrl;\n let response = await fetch(fetchUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.status}`);\n }\n\n const result = await response.json();\n schemas = schemas.concat(result.items ); // Concatenate each page's items to the schemas array\n\n nextPageKey = result.nextPageKey; // Assuming nextPageKey is provided for pagination\n } while (nextPageKey);\n\n // Extract schemaIds into an array\n const schemaIds = schemas.map(schema => schema.schemaId);\n\n // Return array of schemaIds\n return schemaIds;\n } catch (error) {\n console.error('Fetch error:', error);\n throw error;\n }\n}\n\n// Function call\nfetchAllSchemasAndObjects;\n","multiple":false,"defaultValue":"builtin:preferences.privacy","visible":true},{"key":"none","type":"text","visible":true,"defaultValue":"Please enter scope"},{"key":"ObjectId","type":"text","visible":true}],"tiles":{"1":{"type":"code","title":"Dump selected schema","input":"export default async function fetchAllSchemas() {\n const baseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/schemas/'+ $schema;\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n \n const response = await fetch(baseUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n// if (!response.ok) {\n// throw new Error(`Error: ${response.status}`);\n \n\n const result = await response.json();\n\n return (result);\n\n \n }","visualizationSettings":{"thresholds":[],"chartSettings":{"gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxis":"dynatrace","valueAxis":"maxObjects","categoryAxisLabel":"dynatrace","valueAxisLabel":"maxObjects"}},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","autoscale":true,"alignment":"center","colorThresholdTarget":"value","recordField":"error","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[],"lineWrapIds":[],"columnWidths":{},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{"value":"dynatrace"},"displayedFields":["dynatrace"],"colorMode":"color-palette","colorPalette":"categorical"},"histogram":{"dataMappings":[{"valueAxis":"maxObjects","rangeAxis":""}],"variant":"single","displayedFields":["dynatrace","schemaId","displayName","description","documentation","version"]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false},"visualization":"raw"},"4":{"type":"code","title":"Effective value's in scope: $none","input":"export default async function fetchAllSchemas() {\n const baseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/effectiveValues?schemaIds=' +$schema+ '&scope=' +$none+ '&fields=origin,value';\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n const response = await fetch(baseUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n// if (!response.ok) {\n// throw new Error(`Error: ${response.status}`);\n \nlet schemas = [];\n const result = await response.json();\n \n if (result.items) {\n // Extract and clean necessary fields from each item\n \n const cleanedItems = result.items.map(item => ({\n schemaId: item.schemaId,\n displayName: item.displayName,\n latestSchemaVersion: item.schemaVersion,\n objectId: item.objectId,\n summary: item.summary,\n searchSummary: item.searchSummary,\n created: item.created,\n modified: item.modified,\n createdBy: item.createdBy,\n modifiedBy: item.modifiedBy,\n author: item.author,\n updateToken: item.updateToken,\n scope: item.scope,\n modificationInfo: item.modificationInfo,\n schemaId: item.schemaId,\n schemaVersion: item.schemaVersion,\n value: item.value,\n externalId: item.externalId\n \n\n\n\n \n }));\n schemas = schemas.concat(cleanedItems);\n }\n\n return (schemas);\n\n \n }","visualizationSettings":{"thresholds":[],"chartSettings":{"gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxisLabel":"dynatrace","valueAxisLabel":"maxObjects"}},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","autoscale":true,"alignment":"center","colorThresholdTarget":"value","recordField":"error","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[],"lineWrapIds":[],"columnWidths":{},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{},"displayedFields":[]},"histogram":{"dataMappings":[],"variant":"single","displayedFields":[]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false},"visualization":"raw"},"6":{"type":"code","title":"Get schema and objects","input":"export default async function fetchAllSchemasAndObjects() {\n const schemaBaseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/schemas?fields=schemaId%2CdisplayName%2ClatestSchemaVersion';\n const objectBaseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/objects';\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n let schemas = [];\n let nextPageKey = null;\n\n try {\n // Fetch all schemas\n do {\n const fetchUrl = nextPageKey ? `${schemaBaseUrl}&nextPageKey=${nextPageKey}` : schemaBaseUrl;\n let response = await fetch(fetchUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.status}`);\n }\n\n const result = await response.json();\n schemas = schemas.concat(result.items || []); // Concatenate each page's items to the schemas array\n\n nextPageKey = result.nextPageKey; // Assuming nextPageKey is provided for pagination\n } while (nextPageKey);\n\n // For each schema, fetch the associated objects\n for (let schema of schemas) {\n let schemaId = schema.schemaId;\n let objects = [];\n let objectNextPageKey = null;\n\n try {\n do {\n const fetchUrl = objectNextPageKey \n ? `${objectBaseUrl}?schemaIds=${schemaId}&fields=objectId,summary,searchSummary,created,modified,createdBy,modifiedBy,author,updateToken,scope,modificationInfo,schemaId,schemaVersion,value,externalId&nextPageKey=${objectNextPageKey}` \n : `${objectBaseUrl}?schemaIds=${schemaId}&fields=objectId,summary,searchSummary,created,modified,createdBy,modifiedBy,author,updateToken,scope,modificationInfo,schemaId,schemaVersion,value,externalId`;\n \n let response = await fetch(fetchUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n if (!response.ok) {\n throw new Error(`Error fetching objects for schema ${schemaId}: ${response.status}`);\n }\n\n const result = await response.json();\n if (result.items && result.items.length > 0) {\n objects = objects.concat(result.items); // Concatenate each page's items to the objects array\n } else {\n console.log(`No objects found for schema ${schemaId}, skipping.`);\n break; // Exit the do-while loop if no objects found\n }\n\n objectNextPageKey = result.nextPageKey; // Assuming nextPageKey is provided for pagination\n } while (objectNextPageKey);\n\n // Attach the fetched objects to the respective schema if any objects were found\n if (objects.length > 0) {\n schema.objects = objects;\n }\n } catch (error) {\n console.error(`Error fetching objects for schema ${schemaId}:`, error);\n schema.objectsFetchError = error.message; // Add error message to schema for troubleshooting\n }\n }\n\n // Return the collected schemas and their associated objects as a JSON object\n return schemas;\n } catch (error) {\n console.error('Fetch error:', error);\n throw error;\n }\n}\n\n// Function call\nfetchAllSchemasAndObjects().then((schemas) => {\n console.log(JSON.stringify(schemas, null, 2)); // Pretty-print the JSON object\n}).catch(error => {\n console.error('Error fetching schemas and objects:', error);\n});\n","visualization":"table","visualizationSettings":{"thresholds":[],"chartSettings":{"xAxisScaling":"analyzedTimeframe","gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxis":["schemaId","displayName","latestSchemaVersion","objectsFetchError"],"categoryAxisLabel":"schemaId,displayName,latestSchemaVersion,objectsFetchError","valueAxis":[],"valueAxisLabel":"","tooltipVariant":"single"},"truncationMode":"middle"},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","recordField":"error","autoscale":true,"alignment":"center","colorThresholdTarget":"value","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[],"lineWrapIds":[],"columnWidths":{"[\"objectsFetchError\"]":251.91070556640625},"sortBy":{"columnId":"[\"objects\"]","direction":"descending"},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{"value":"schemaId"},"displayedFields":["schemaId"],"colorMode":"color-palette","colorPalette":"categorical"},"histogram":{"dataMappings":[],"variant":"single","displayedFields":["schemaId","displayName","latestSchemaVersion","objectsFetchError"]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false}},"10":{"type":"code","title":"Get object changes","input":"export default async function fetchAllSchemas() {\n const baseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/objects?schemaIds='+$schema+ '&fields=objectId,summary,searchSummary,created,modified,createdBy,modifiedBy,author,updateToken,scope,modificationInfo,schemaId,schemaVersion,value,externalId' \n ;\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n try {\n const response = await fetch(baseUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.status}`);\n }\n\n let schemas = [];\n const result = await response.json();\n \n if (result.items) {\n // Extract and clean necessary fields from each item\n const cleanedItems = result.items.map(item => ({\n schemaId: item.schemaId,\n displayName: item.displayName,\n latestSchemaVersion: item.schemaVersion,\n objectId: item.objectId,\n summary: item.summary,\n searchSummary: item.searchSummary,\n created: item.created,\n modified: item.modified,\n createdBy: item.createdBy,\n modifiedBy: item.modifiedBy,\n author: item.author,\n updateToken: item.updateToken,\n scope: item.scope,\n modificationInfo: item.modificationInfo,\n schemaVersion: item.schemaVersion,\n value: item.value,\n externalId: item.externalId,\n // Convert timestamps to human-readable format\n humanReadableCreated: item.created ? new Date(item.created).toLocaleString() : null,\n humanReadableModified: item.modified ? new Date(item.modified).toLocaleString() : null\n }));\n schemas = schemas.concat(cleanedItems);\n }\n\n return schemas;\n } catch (error) {\n console.error('Fetch error:', error);\n throw error;\n }\n}\n\n// Example function call\nconst schemaValue = \"your-schema-value\"; // Replace this with the actual schema value you want to filter by\nfetchAllSchemas(schemaValue).then(schemas => {\n console.log(JSON.stringify(schemas, null, 2)); // Pretty-print the JSON object\n}).catch(error => {\n console.error('Error fetching schemas:', error);\n});\n","visualization":"table","visualizationSettings":{"thresholds":[],"chartSettings":{"gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxis":"schemaId","valueAxis":"created","categoryAxisLabel":"schemaId","valueAxisLabel":"created"}},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","recordField":"error","autoscale":true,"alignment":"center","colorThresholdTarget":"value","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[["created"],["modified"]],"lineWrapIds":[],"columnWidths":{"[\"objectId\"]":211},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{"value":"schemaId"},"displayedFields":["schemaId"],"colorMode":"color-palette","colorPalette":"categorical"},"histogram":{"dataMappings":[{"valueAxis":"created","rangeAxis":""},{"valueAxis":"modified","rangeAxis":""}],"variant":"single","displayedFields":["schemaId","latestSchemaVersion","objectId","summary","searchSummary","author","updateToken","scope","schemaVersion","humanReadableCreated","humanReadableModified"]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false}},"11":{"type":"code","title":"Get all objects in schema","input":"export default async function fetchAllSchemas() {\n const baseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/objects?schemaIds='+$schema+ '&fields=objectId,summary,searchSummary,created,modified,createdBy,modifiedBy,author,updateToken,scope,modificationInfo,schemaId,schemaVersion,value,externalId' \n ;\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n\n try {\n const response = await fetch(baseUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n if (!response.ok) {\n throw new Error(`Error: ${response.status}`);\n }\n\n let schemas = [];\n const result = await response.json();\n \n if (result.items) {\n // Extract and clean necessary fields from each item\n const cleanedItems = result.items.map(item => ({\n schemaId: item.schemaId,\n displayName: item.displayName,\n latestSchemaVersion: item.schemaVersion,\n objectId: item.objectId,\n summary: item.summary,\n searchSummary: item.searchSummary,\n created: item.created,\n modified: item.modified,\n createdBy: item.createdBy,\n modifiedBy: item.modifiedBy,\n author: item.author,\n updateToken: item.updateToken,\n scope: item.scope,\n modificationInfo: item.modificationInfo,\n schemaVersion: item.schemaVersion,\n value: item.value,\n externalId: item.externalId,\n // Convert timestamps to human-readable format\n humanReadableCreated: item.created ? new Date(item.created).toLocaleString() : null,\n humanReadableModified: item.modified ? new Date(item.modified).toLocaleString() : null\n }));\n schemas = schemas.concat(cleanedItems);\n }\n\n return schemas;\n } catch (error) {\n console.error('Fetch error:', error);\n throw error;\n }\n}\n\n// Example function call\nconst schemaValue = \"your-schema-value\"; // Replace this with the actual schema value you want to filter by\nfetchAllSchemas(schemaValue).then(schemas => {\n console.log(JSON.stringify(schemas, null, 2)); // Pretty-print the JSON object\n}).catch(error => {\n console.error('Error fetching schemas:', error);\n});\n","visualization":"raw","visualizationSettings":{"thresholds":[],"chartSettings":{"gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxis":"schemaId","valueAxis":"created","categoryAxisLabel":"schemaId","valueAxisLabel":"created"}},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","recordField":"error","autoscale":true,"alignment":"center","colorThresholdTarget":"value","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[["created"],["modified"]],"lineWrapIds":[],"columnWidths":{},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{"value":"schemaId"},"displayedFields":["schemaId"],"colorMode":"color-palette","colorPalette":"categorical"},"histogram":{"dataMappings":[{"valueAxis":"created","rangeAxis":""},{"valueAxis":"modified","rangeAxis":""}],"variant":"single","displayedFields":["schemaId","latestSchemaVersion","objectId","summary","searchSummary","author","updateToken","scope","schemaVersion","humanReadableCreated","humanReadableModified"]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false}},"12":{"type":"code","title":"Get full object json","input":"export default async function fetchAllSchemas() {\n const baseUrl = 'https://yourenv.live.dynatrace.com/api/v2/settings/objects/' + $ObjectId;\n const headers = {\n \"Authorization\": \"Api-Token dt0c01.add your token\",\n \"Accept\": \"application/json; charset=utf-8\"\n };\n\n const response = await fetch(baseUrl, { method: \"GET\", headers: headers });\n console.log(response.status);\n\n// if (!response.ok) {\n// throw new Error(`Error: ${response.status}`);\n \n\n const result = await response.json();\n \n \n\n return (result);\n\n \n }","visualizationSettings":{"thresholds":[],"chartSettings":{"gapPolicy":"connect","circleChartSettings":{"groupingThresholdType":"relative","groupingThresholdValue":0,"valueType":"relative"},"categoryOverrides":{},"categoricalBarChartSettings":{"categoryAxisLabel":"objectId","valueAxisLabel":"created","categoryAxis":"objectId","valueAxis":"created"}},"singleValue":{"showLabel":true,"label":"error","prefixIcon":"","autoscale":true,"alignment":"center","colorThresholdTarget":"value","recordField":"error","trend":{"trendType":"auto","isVisible":true}},"table":{"rowDensity":"condensed","enableSparklines":false,"hiddenColumns":[],"lineWrapIds":[],"columnWidths":{},"columnTypeOverrides":[]},"honeycomb":{"shape":"hexagon","legend":"auto","dataMappings":{"value":"created"},"displayedFields":["objectId","summary","searchSummary","author","updateToken","scope","schemaId","schemaVersion"],"colorMode":"color-palette","colorPalette":"blue"},"histogram":{"dataMappings":[{"valueAxis":"created","rangeAxis":""},{"valueAxis":"modified","rangeAxis":""}],"variant":"single","displayedFields":["objectId","summary","searchSummary","author","updateToken","scope","schemaId","schemaVersion"]}},"querySettings":{"maxResultRecords":1000,"defaultScanLimitGbytes":500,"maxResultMegaBytes":1,"defaultSamplingRatio":10,"enableSampling":false},"visualization":"raw"}},"layouts":{"1":{"x":0,"y":4,"w":22,"h":5},"4":{"x":0,"y":12,"w":22,"h":5},"6":{"x":0,"y":0,"w":22,"h":4},"10":{"x":0,"y":17,"w":22,"h":5},"11":{"x":0,"y":9,"w":22,"h":3},"12":{"x":0,"y":22,"w":22,"h":5}},"importedWithCode":true,"settings":{}}