Retrieve EventResponse - m3ter Documentation

Retrieve EventResponse

cURL

curl --request GET \
  --url https://api.m3ter.com/organizations/{orgId}/events/{id} \
  --header 'Authorization: Bearer <token>'

Python

import requests

url = "https://api.m3ter.com/organizations/{orgId}/events/{id}"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript (Fetch)

const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.m3ter.com/organizations/{orgId}/events/{id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/events/{id}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",\n  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://api.m3ter.com/organizations/{orgId}/events/{id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Unirest (Java)

HttpResponse<String> response = Unirest.get("https://api.m3ter.com/organizations/{orgId}/events/{id}")
  .header("Authorization", "Bearer <token>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.m3ter.com/organizations/{orgId}/events/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body

Sample Response

Success (200)

{
  "id": "9cb46d85-7cb6-4637-80a1-d4ec38e4ab30",
  "eventName": "configuration.commitment.created",
  "eventTime": "2022-10-28T13:54:49.557Z",
  "dtActioned": "2022-10-28T13:56:49.557Z",
  "m3terEvent": {
    "eventData": {
      "newDto": {
        "commitmentFeeDescription": "",
        "endDate": "2024-12-31",
        "billingInterval": 1,
        "orgId": "396d788d-5174-XXXX-9d69-YYYY4671fc33",
        "overageSurchargePercent": 5,
        "overageDescription": "",
        "currency": "USD",
        "id": "480d317e-2030-416b-b64b-c07577c418b4",
        "amountSpent": 0,
        "accountCode": "doetech_premium",
        "amount": 15000,
        "billingOffset": 0,
        "lastModifiedBy": "USER_810e3a43-XXXX-4dab-YYYY-470977405b58",
        "billingPlanId": "0409e75a-8a87-43de-aa58-fc6ec823ce37",
        "version": 1,
        "accountId": "1cf2a754-476c-498c-b05a-7d41abfc404d",
        "dtCreated": "2022-10-28T13:54:48.081781Z",
        "amountPrePaid": 0,
        "productIds": [
          "bec371ef-dbad-4e73-a56a-dadecff2287c"
        ],
        "createdBy": "USER_810e3a43-XXXX-4dab-YYYY-470977405b58",
        "contractId": "68595d6d-261f-496b-bf88-51fc7d2b5ccc",
        "commitmentUsageDescription": "",
        "startDate": "2023-01-01",
        "dtLastModified": "2022-10-28T13:54:48.081781Z"
      }
    }
  }
}

Error Responses

{
  "message": "<string>"
}
{
  "message": "<string>"
}

Authorizations

Authorization
Type: string Header: Required
m3ter supports machine to machine authentication using the clientCredentials OAuth2 flow.

Path Parameters

Response Details