This topic helps you get started making API calls as a Service User to the m3ter platform. It explains how to quickly get set up to make API calls and provides example calls to help you reach a point where you can begin to submit usage data measurements as a Service User:Documentation Index
Fetch the complete documentation index at: https://docs.m3ter.com/llms.txt
Use this file to discover all available pages before exploring further.
- Setting Up for Service User API Calls
- Example 1: Submit Measurements
- Example 2: Get Organization Config
- Example 3: Create Meter
Setting Up for Service User API Calls
Follow these steps to get set up as a Service User able to make API calls to m3ter:Step 1: Create a Service User and add Permissions
- Log in to the m3ter Console and under Settings>Users, create a Service User.
- Add required Permissions to the new Service User. You must assign Administrator Permissions to a Service User to allow that user to make API calls. See Adding Permissions to Service Users.
Step 2: Generate Access Keys for the Service User.
- In the Console, open the Overview page for a Service User and generate an Access Key id and Api Secret.
- Make sure you make a copy of the Api Secret.
Step 3: Use Basic Authentication to obtain a Bearer Token.
- We maintain an OAuth 2.0 Client Credentials grant type authentication flow for Service User Authentication.
- From your preferred OAuth 2.0 client, submit a request to the m3ter OAuth Client Credentials authentication flow using the Access Key id and** Api Secret** to obtain a Bearer Token for your Service User.
- You will need the Bearer Token to make any subsequent API calls.
Step 4: Copy your Organization Id.
- When you have obtained your Service User Bearer Token at Step 3, you will also need a copy of your Organization Id to make any subsequent API calls.
- You can copy this directly to your clipboard from the Settings>Organization Details page in the Console - see Managing your Organization.
- You can obtain your Organization Id from the URL in your browser after logging in to the m3ter Console:
https://console.m3ter.com/org/``***396d788d-XXXX-4e8b-YYYY-a41f46ZZZZZ3***``/settings/users
In this example, the highlighted portion of the URL after /org/ is the Organization Id.
Example 1: Submit Measurements
In this example, we submit Meter measurements for an Account to the Ingest API. In addition to the JSON shown for the example request made through Postman, code versions using other common languages are given and can be copied directly to your clipboard: To Submit measurement using Postman:- In your Postman Workspace, select to make a POST call and enter this URL as the endpoint:
https://ingest.m3ter.com/organizations/396d788d-XXXX-4e8b-XXXX-aYYYYY3/measurementsWhere the portion of the URL endpoint after
/organizations/ is your Organization id and which you can copy from the URL in your browser after logging into the m3ter Console - see Step 4 in the previous section.
- On the Authorization tab, for Type select Bearer Token and copy and paste it into the Token field:

- Select the Body tab and enter JSON for the request:

- We’re submitting a single measurement for a measure type Data Field on a Meter.
- The
"uid"provided for the measurement must be a unique and immutable string. - For the
"meter"parameter, enter the Meter’scodestring. - For the
"account"parameter, enter the Account’scodestring.
- Click Send. You will see that your submitted Meter measurement has been accepted in the Response panel:

cURL Version
If you are working in the cmd line, here’s the cURL version for this example Submit Measurements call:JavaScript Version
Here’s the JavaScript version of the Submit Measurements call:Python Requests Version
Here’s the Python Requests version of the Submit Measurements call:Java Version
Here’s the Java version of the Submit Measurements call:Example 2: Get Organization Config
In this example, we retrieve the Organization config. To obtain your Organization Config using Postman:- In your Postman Workspace, select to make a GET call and enter this URL as the endpoint:
https://api.m3ter.com/organizations/396d788d-XXXX-4e8b-XXXX-a41fZZZZZ3/organizationconfig
- On the Authorization tab, for Type select Bearer Token and copy and paste it into the Token field:

- Click Send. Your Organization Config is returned into the Response panel:

Example 3: Create Meter
In this example, we create a Meter. To Create a Meter using Postman:- In your Postman Workspace, select to make a POST call and enter this URL as the endpoint:
https://api.m3ter.com/organizations/396d788d-XXXX-4e8b-XXXX-a41fZZZZZ3/meters
- On the Authorization tab, for Type select Bearer Token and copy and paste it into the Token field.
- Select the Body tab and enter JSON for the request:

- Click Send. You’ll see the newly created Meter details returned in the Response panel:

cURL Version
If you are working in the cmd line, here’s the cURL version for this example Create Meter call:Python Requests Version
Here’s the Python Requests version for this example Create Meter call:Importing m3ter Collections into your Postman Workspace
If you are working in Postman for making API calls to m3ter, some m3ter Collections are available for you to import into your Postman Workspace. These Collections provide examples of calls you’ll typically need to make to the m3ter APIs:- Importing the m3ter Open API
- m3ter Open API. The entire set of available API calls for the m3ter platform.
- Importing the m3ter-Template API Collection
- m3ter-Template Collection. A set of templated calls arranged by key functional area and covering calls for common operations in these areas.
Importing the m3ter Open API
To import the m3ter Open API as a Collection into your Postman Workspace:- Go to the m3ter API Reference documentation.
- In the Getting Started section, select Postman.
- On the Postman page, select the m3ter Open API spec JSON file link:

- A
spec.jsonfile opens in a separate browser tab.
- Save the file locally.
- In your Postman Workspace, select Import:

- An Import dialog appears:

- Select to import files. A File Upload window appears.
- Navigate to where you’ve saved the
spec.jsonfile locally and select Open:
- The Import dialog adjusts to show progress for the import process.
- When the import process has completed, you can select how you want to complete the import:

- In this example, we’ve selected to import the file as a Postman Collection.
- Select Import.
- The m3ter API is loaded into the Collections panel in your Postman Workspace:

Importing the m3ter-Template API Collection
To import the m3ter-Template Collection into your Postman Workspace:- Go to the m3ter API Reference documentation.
- In the Getting Started section, select Postman.
- On the Postman page, copy the link provided for the m3ter-Template API Collection:

- In your Postman Workspace, select Collections.
- Select Import:

- An Import dialog appears.
- Paste the URL link into the import target field on the dialog.
- The m3ter-Template API Collection is imported into your Workspace:
