You can now connect your account to PowerBI. This enables users to create custom dashboards to view their assets.
To get started,
- Navigate to Account settings
- Select the API and Integrations section
- Click Generate new key
- A unique API key will then be generated for your company. Copy this key and save it for a later step.
- Open PowerBI and create a new report or open the report you wish to edit.
- From the ribbon, select Transform Data
- From the ribbon, select Advanced Editor
- Copy the code below into the Advanced Editor. Copy your API Key from step 3 and replace "your-api-key-here" in the code block.
- Click Done
- Proceed editing your dashboard as desired.
let // Set API endpoint URL and authentication header url = "https://sm-api.prod.toolconnect-sbd.com/inventory/export/sync", apiKey = "your-api-key-here", headers = [#"x-api-key"=apiKey, #"Content-Type"="application/json"], body = "{ ""filterConditions"": [ { ""field"": ""toolGroup"", ""contains"": [ ""active"", ""regular"", ""bulk"", ""consumable"" ] } ], ""orderColumns"": [], ""isAllocationExport"": false }", contentBody = Text.ToBinary(body), // Make HTTP request Response = Web.Contents( url, [ Headers=headers, Content=contentBody ] ), // Check response status StatusCode = Value.Metadata(Response)[Response.Status], JsonData = if StatusCode = 200 then Json.Document(Response) else error "Request failed with status code: " & Text.From(StatusCode), // Extract URLs from response s3Url = JsonData[data][s3Url], content = Web.Contents(s3Url), CsvData = Csv.Document(content, [Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv]), #"Promoted Headers" = Table.PromoteHeaders(CsvData, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Tool ID", type text}, {"Description", type text}, {"Type", type text}, {"Tool Added By", type text}, {"Time Created", type datetimezone}, {"Enabled", type text}, {"Time Last Seen", type datetimezone}, {"20V Charge Percent", Int64.Type}, {"Coin Cell Health", type text}, {"Temperature", Int64.Type}, {"Model Number", type text}, {"Manufacturer", type text}, {"Serial Number", type text}, {"Inventory Number", Int64.Type}, {"Category", type text}, {"Assignment Name", type text}, {"Parent Assignment", type text}, {"Point of Contact", type text}, {"Assignment Start", type text}, {"Assignment End", type text}, {"Price", Int64.Type}, {"Price Type", type text}, {"Tool Status", type text}, {"Purchase Date", type text}, {"Note", type text}, {"Mac", type text}, {"Barcode", type text}, {"Audit Status", type text}, {"Last Audit", type text}, {"Last Auditor", type text}, {"Linked Mac", type text}, {"Job Code", type text}, {"Quantity", type text}, {"Custom Field 1", type text}, {"Custom Field 2", type text}, {"Custom Field 3", type text}, {"Custom Field 4", type text}, {"Custom Field 5", type text}, {"Custom Field 6", type text}, {"Custom Field 7", type text}, {"Custom Field 8", type text}, {"Custom Field 0", type text}, {"Responsible person", type text}}) in #"Changed Type"
Comments
0 comments
Please sign in to leave a comment.