diff --git a/index.html b/index.html index 26d7bb6..6d9dac2 100644 --- a/index.html +++ b/index.html @@ -527,22 +527,6 @@
--Code samples
-
# You can also use wget
-curl -X POST https://api.moesif.com/v1/~/billing/reports/balance_transactions
-
-
const fetch = require('node-fetch');
-
-fetch('https://api.moesif.com/v1/~/billing/reports/balance_transactions',
-{
- method: 'POST'
-
-})
-.then(function(res) {
- return res.json();
-}).then(function(body) {
- console.log(body);
-});
-
-
import requests
-
-r = requests.post('https://api.moesif.com/v1/~/billing/reports/balance_transactions')
-
-print(r.json())
-
-
require 'rest-client'
-require 'json'
-
-result = RestClient.post 'https://api.moesif.com/v1/~/billing/reports/balance_transactions',
- params: {
- }
-
-p JSON.parse(result)
-
-
<?php
-
-require 'vendor/autoload.php';
-
-$client = new \GuzzleHttp\Client();
-
-// Define array of request body.
-$request_body = array();
-
-try {
- $response = $client->request('POST','https://api.moesif.com/v1/~/billing/reports/balance_transactions', array(
- 'headers' => $headers,
- 'json' => $request_body,
- )
- );
- print_r($response->getBody()->getContents());
- }
- catch (\GuzzleHttp\Exception\BadResponseException $e) {
- // handle exception or api errors.
- print_r($e->getMessage());
- }
-
- // ...
-
-
package main
-
-import (
- "bytes"
- "net/http"
-)
-
-func main() {
-
- data := bytes.NewBuffer([]byte{jsonReq})
- req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/reports/balance_transactions", data)
- req.Header = headers
-
- client := &http.Client{}
- resp, err := client.Do(req)
- // ...
-}
-
-
using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text;
-using System.Threading.Tasks;
-using Newtonsoft.Json;
-
-/// <<summary>>
-/// Example of Http Client
-/// <</summary>>
-public class HttpExample
-{
- private HttpClient Client { get; set; }
-
- /// <<summary>>
- /// Setup http client
- /// <</summary>>
- public HttpExample()
- {
- Client = new HttpClient();
- }
-
-
- /// Make a dummy request
- public async Task MakePostRequest()
- {
- string url = "https://api.moesif.com/v1/~/billing/reports/balance_transactions";
-
-
- await PostAsync(null, url);
-
- }
-
- /// Performs a POST Request
- public async Task PostAsync(undefined content, string url)
- {
- //Serialize Object
- StringContent jsonContent = SerializeObject(content);
-
- //Execute POST request
- HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
- }
-
-
-
- /// Serialize an object to Json
- private StringContent SerializeObject(undefined content)
- {
- //Serialize Object
- string jsonObject = JsonConvert.SerializeObject(content);
-
- //Create Json UTF8 String Content
- return new StringContent(jsonObject, Encoding.UTF8, "application/json");
- }
-
- /// Deserialize object from request response
- private async Task DeserializeObject(HttpResponseMessage response)
- {
- //Read body
- string responseBody = await response.Content.ReadAsStringAsync();
-
- //Deserialize Body to object
- var result = JsonConvert.DeserializeObject(responseBody);
- }
-}
-
-
URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/balance_transactions");
-HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-con.setRequestMethod("POST");
-int responseCode = con.getResponseCode();
-BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
-String inputLine;
-StringBuffer response = new StringBuffer();
-while ((inputLine = in.readLine()) != null) {
- response.append(inputLine);
-}
-in.close();
-System.out.println(response.toString());
-
-
POST /~/billing/reports/balance_transactions
Name | -In | -Type | -Required | -Description | -
---|
Status | -Meaning | -Description | -Schema | -
---|
# You can also use wget
curl -X GET https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z \
- -H 'Accept: application/json'
+ -H 'Accept: application/json' \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
const fetch = require('node-fetch');
const headers = {
- 'Accept':'application/json'
+ 'Accept':'application/json',
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
};
fetch('https://api.moesif.com/v1/~/billing/reports/metrics?from=2019-08-24T14%3A15%3A22Z&to=2019-08-24T14%3A15%3A22Z',
@@ -11936,7 +11745,8 @@ getBillingReportsMetrics
import requests
headers = {
- 'Accept': 'application/json'
+ 'Accept': 'application/json',
+ 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
}
r = requests.get('https://api.moesif.com/v1/~/billing/reports/metrics', params={
@@ -11949,7 +11759,8 @@ getBillingReportsMetrics
require 'json'
headers = {
- 'Accept' => 'application/json'
+ 'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
}
result = RestClient.get 'https://api.moesif.com/v1/~/billing/reports/metrics',
@@ -11966,6 +11777,7 @@ getBillingReportsMetrics
$headers = array(
'Accept' => 'application/json',
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
);
$client = new \GuzzleHttp\Client();
@@ -11999,6 +11811,7 @@ getBillingReportsMetrics
headers := map[string][]string{
"Accept": []string{"application/json"},
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
}
data := bytes.NewBuffer([]byte{jsonReq})
@@ -12200,8 +12013,9 @@ Responses
-
+Balance Transactions
+createBalanceTransaction
+
+
+
+Code samples
+
+# You can also use wget
+curl -X POST https://api.moesif.com/v1/~/billing/reports/balance_transactions \
+ -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'
+
+
const fetch = require('node-fetch');
+
+const headers = {
+ 'Authorization':'Bearer YOUR_MANAGEMENT_API_KEY'
+};
+
+fetch('https://api.moesif.com/v1/~/billing/reports/balance_transactions',
+{
+ method: 'POST',
+
+ headers: headers
+})
+.then(function(res) {
+ return res.json();
+}).then(function(body) {
+ console.log(body);
+});
+
+
import requests
+headers = {
+ 'Authorization': 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
+
+r = requests.post('https://api.moesif.com/v1/~/billing/reports/balance_transactions', headers = headers)
+
+print(r.json())
+
+
require 'rest-client'
+require 'json'
+
+headers = {
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY'
+}
+
+result = RestClient.post 'https://api.moesif.com/v1/~/billing/reports/balance_transactions',
+ params: {
+ }, headers: headers
+
+p JSON.parse(result)
+
+
<?php
+
+require 'vendor/autoload.php';
+
+$headers = array(
+ 'Authorization' => 'Bearer YOUR_MANAGEMENT_API_KEY',
+);
+
+$client = new \GuzzleHttp\Client();
+
+// Define array of request body.
+$request_body = array();
+
+try {
+ $response = $client->request('POST','https://api.moesif.com/v1/~/billing/reports/balance_transactions', array(
+ 'headers' => $headers,
+ 'json' => $request_body,
+ )
+ );
+ print_r($response->getBody()->getContents());
+ }
+ catch (\GuzzleHttp\Exception\BadResponseException $e) {
+ // handle exception or api errors.
+ print_r($e->getMessage());
+ }
+
+ // ...
+
+
package main
+
+import (
+ "bytes"
+ "net/http"
+)
+
+func main() {
+
+ headers := map[string][]string{
+ "Authorization": []string{"Bearer YOUR_MANAGEMENT_API_KEY"},
+ }
+
+ data := bytes.NewBuffer([]byte{jsonReq})
+ req, err := http.NewRequest("POST", "https://api.moesif.com/v1/~/billing/reports/balance_transactions", data)
+ req.Header = headers
+
+ client := &http.Client{}
+ resp, err := client.Do(req)
+ // ...
+}
+
+
using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+
+/// <<summary>>
+/// Example of Http Client
+/// <</summary>>
+public class HttpExample
+{
+ private HttpClient Client { get; set; }
+
+ /// <<summary>>
+ /// Setup http client
+ /// <</summary>>
+ public HttpExample()
+ {
+ Client = new HttpClient();
+ }
+
+
+ /// Make a dummy request
+ public async Task MakePostRequest()
+ {
+ string url = "https://api.moesif.com/v1/~/billing/reports/balance_transactions";
+
+
+ await PostAsync(null, url);
+
+ }
+
+ /// Performs a POST Request
+ public async Task PostAsync(undefined content, string url)
+ {
+ //Serialize Object
+ StringContent jsonContent = SerializeObject(content);
+
+ //Execute POST request
+ HttpResponseMessage response = await Client.PostAsync(url, jsonContent);
+ }
+
+
+
+ /// Serialize an object to Json
+ private StringContent SerializeObject(undefined content)
+ {
+ //Serialize Object
+ string jsonObject = JsonConvert.SerializeObject(content);
+
+ //Create Json UTF8 String Content
+ return new StringContent(jsonObject, Encoding.UTF8, "application/json");
+ }
+
+ /// Deserialize object from request response
+ private async Task DeserializeObject(HttpResponseMessage response)
+ {
+ //Read body
+ string responseBody = await response.Content.ReadAsStringAsync();
+
+ //Deserialize Body to object
+ var result = JsonConvert.DeserializeObject(responseBody);
+ }
+}
+
+
URL obj = new URL("https://api.moesif.com/v1/~/billing/reports/balance_transactions");
+HttpURLConnection con = (HttpURLConnection) obj.openConnection();
+con.setRequestMethod("POST");
+int responseCode = con.getResponseCode();
+BufferedReader in = new BufferedReader(
+ new InputStreamReader(con.getInputStream()));
+String inputLine;
+StringBuffer response = new StringBuffer();
+while ((inputLine = in.readLine()) != null) {
+ response.append(inputLine);
+}
+in.close();
+System.out.println(response.toString());
+
+
+POST /~/billing/reports/balance_transactions
+
+Post BillingReports Balance Transactions
+
+Post a billing report of type balance_transaction
+
+Parameters
+
+
+
+Name
+In
+Type
+Required
+Description
+
+
+
+body
+body
+undefined
+false
+none
+
+
+
+Responses
+
+
+
+Status
+Meaning
+Description
+Schema
+
+
+
+204
+No Content
+success, no content and BillingReports were created or updated
+None
+
+
+
+
+To perform this operation, you must be authenticated by means of one of the following methods:
+managementAPIToken ( Scopes: create:billing_meters create:billing_reports )
+
+
OAuth
getTokenInfo
diff --git a/openapi/management-api.json b/openapi/management-api.json
index f0497d1..1ef9048 100644
--- a/openapi/management-api.json
+++ b/openapi/management-api.json
@@ -3571,6 +3571,14 @@
},
"/~/billing/reports/metrics": {
"get": {
+ "security": [
+ {
+ "managementAPIToken": [
+ "create:billing_meters",
+ "create:billing_reports"
+ ]
+ }
+ ],
"description": "Get BillingReports' values for a given meter and time range for a single company or all companies",
"tags": [
"Billing Reports"
@@ -3950,7 +3958,22 @@
},
"/~/billing/reports/balance_transactions": {
"post": {
- "operationId": "createBalanceTransactionBillingReport",
+ "security": [
+ {
+ "managementAPIToken": [
+ "create:billing_meters",
+ "create:billing_reports"
+ ]
+ }
+ ],
+ "description": "Post a billing report of type balance_transaction",
+ "tags": [
+ "Balance Transactions"
+ ],
+ "operationId": "createBalanceTransaction",
+ "consumes": [
+ "application/json"
+ ],
"parameters": [
{
"schema": {
@@ -3968,11 +3991,21 @@
"in": "query",
"name": "app_id",
"required": false
+ },
+ {
+ "schema": {
+ "$ref": "#/components/schemas/billingreports.BillingReportBalanceTransCreate"
+ },
+ "in": "body",
+ "name": "body"
}
],
- "tags": [
- "routes"
- ]
+ "summary": "Post BillingReports Balance Transactions",
+ "responses": {
+ "204": {
+ "description": "success, no content and BillingReports were created or updated"
+ }
+ }
}
},
"/~/dashboards/{dashId}/cascade": {