File Uploads for Data Ingest

You can upload a JSON document containing measurements data, which will be ingested into m3ter. This is a two-stage process:

1. First, obtain an upload URL from the m3ter service 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. The call will return a URL in the response, which is time limited - it is valid for one minute.

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

2. 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 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

     }

  },

  .

  .

  .

]

Next: Submitting Test Usage Data