File Upload Service API - m3ter Documentation

Documentation Index

Fetch the complete documentation index at: /llms.txt

Use this file to discover all available pages before exploring further.

You can use the m3ter File Upload Service API to upload a usage data measurements data files to the platform in preparation for measurements ingest:

Maximum File Size! You can upload JSON files up to 1GB in size using the File Upload service.

This topic explains how to use the file upload service API to upload a usage data measurements file, and explains which API calls you can use to troubleshoot any issues you encounter:

If you have prepared a JSON file for upload using the File Upload Service API, then you can open a Meter Details page in the Console and also upload the file from there:

Uploading a Measurements Data File

This is a two-stage process:

  1. First, obtain an upload URL from the m3ter platform by making a POST request to this endpoint:

https://api.m3ter.com/organizations/{orgId}/fileuploads/measurements/generateUploadUrl

The request body for this call should have the following structure:

{
  "fileName": "measurements_2022_02_14.json",
  "contentType": "text/json",
  "contentLength": 209
}

The fileName and contentLength parameter values you use will be specific to the file you intend to upload. In the response, the call will return:

Note: Authentication with Platform. To make the POST generateUploadUrl API call, you’ll have to use a Bearer Token you’ve obtained for authentication with the platform. For more details, see Service Authentication.

More Details? See the API Reference documentation for the Generate an upload URL API call.

  1. Second, when you have received the response to your request for an upload URL, you can upload the data in your file using a PUT request to the returned upload URL. The binary data from the file should form the request body and the file should contain an array of measurements data. For example:
   [
     {
       "uid": "xxxxxxxx-62f7-45ea-a916-xxxxxxxxxxxx",
       "meter": "api_request",
       "account": "acme_corp",
       "ts": "2022-02-14T11:30:51.897Z",
       "measure": {
         "quantity": 1.0
       }
     },
     .
     .
     .
   ]

Troubleshooting Measurement File Uploads

If any issues occur with your measurements data file upload, file upload service API calls are available to help you follow up and troubleshoot:

More Details? For more details on how to make the API calls referred to in this section, see the Measurements section of our API Reference documentation.

Downloading Previously Uploaded Measurements File

You can retrieve a measurements file that you’ve previously uploaded to the file upload service:

Follow a two-step process:

Obtaining File Upload Job Details

You can use two calls to obtain details of file upload jobs:

Uploading a Measurements Data File in the Console

If you have prepared a usage data measurements file in JSON format ready for upload using the File Upload Service, you can perform the upload directly in the Console.

Warning: Using correct JSON format! Please review the section above before you attempt to upload a usage data measurements file through the Console - an example is given of the array format required in your JSON file. If you attempt to upload a file using the incorrect JSON format, then you’ll receive an error and the upload will fail.

To upload a JSON measurements data file in the Console:

  1. Select Metering. The Meters page opens.

  2. Select the name hotlink text of the Meter. The Meter Details page opens.

  3. Scroll down the page to the Submit Measurements panel.

  4. Select the File Upload API tab:

  5. You can perform the measurements data file upload in one of two ways:

PLEASE NOTE!