API quickstart

Quick guide: mWater CSV data via API call
You can programmatically bring data from mWater to another system in just a few steps by creating a datagrid and using the API command that is generated when downloading that datagrid. Here we cover the steps on how to get that API call, and how to use it in PowerBI and Google Sheets to bring through real-time data.
1) Create a Datagrid with your chosen columns and filters
2) Go to download the CSV of the datagrid
Download > As CSV
Download > As CSV
3) Take the URL which appears in the browser when you've clicked the download as CSV link referencing api.mwater.co

4) This is a fully formed API call you can use to integrate with other systems such as PowerBI

Get Data > CSV
Get Data > CSV

Building the API call

The URL does not appear in the URL bar for very long. You can build this API call yourself with a few further steps. In a nutshell, use the browser developer tools to get the request URL and add download to the URL after the datagrid ID and before the client ID
https://api.mwater.co/v3/datagrids/[datagrid unique ID]/download?client=[client ID]&share

Open your browser developer tools with Ctrl + Shift + I
Open your browser developer tools with Ctrl + Shift + I
Select the Network tab. This shows what network traffic is happening with the page.
Select the Network tab. This shows what network traffic is happening with the page.
 Download the CSV from the datagrid. You will see the command show up in the network tab. Use the Request URL as the basis of your download command.
Download the CSV from the datagrid. You will see the command show up in the network tab. Use the Request URL as the basis of your download command.
Add the keyword download before the client ID parameter to form an API call that returns a CSV file of the datagrid:
https://api.mwater.co/v3/datagrids/fa502b6cc4dd445cb145d8d8de8488ea/download?client=[client ID]&share

PowerBI

  • Open Power BI Desktop:

  • Get Data from Web:

  • Enter API URL:

  • Google Sheets

  • Open your Google Sheets file.
  • Go to Extensions → Apps Script.
  • Add the following script:
  • function importCSVFrommWater() {
        const url = 'YOUR_API_URL_HERE'; // Replace with your mWater API URL
        const response = UrlFetchApp.fetch(url);
        const csvData = Utilities.parseCsv(response.getContentText());
        const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
        sheet.clear(); // Clear existing data
        sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData);
    }

  • Replace YOUR_API_URL_HERE with your mWater API URL.
  • Save and give your script a name.
  • Run the script by clicking the play button ▶️ (you may need to authorize the script first).
  • NOTE: Your Client ID is like your password. Treat it with the same caution! The client IDs used above are fake.
    For more dynamic imports, refer to api.mwater.co