Preview ScheduledBalanceCharges - m3ter Documentation
Preview ScheduledBalanceCharges
cURL
curl --request POST \
--url https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"code": "<string>",
"currency": "<string>",
"servicePeriodStartDate": "2023-11-07T05:31:56Z",
"servicePeriodEndDate": "2023-11-07T05:31:56Z",
"billFrequency": "<unknown>",
"billFrequencyInterval": 183,
"billInAdvance": true,
"chargeDescription": "<string>",
"version": 123,
"customFields": {},
"amount": 1,
"units": 123,
"unitPrice": 123,
"billEpoch": "2023-12-25"
}
'
import requests
url = "https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview"
payload = {
"name": "<string>",
"code": "<string>",
"currency": "<string>",
"servicePeriodStartDate": "2023-11-07T05:31:56Z",
"servicePeriodEndDate": "2023-11-07T05:31:56Z",
"billFrequency": "<unknown>",
"billFrequencyInterval": 183,
"billInAdvance": True,
"chargeDescription": "<string>",
"version": 123,
"customFields": {},
"amount": 1,
"units": 123,
"unitPrice": 123,
"billEpoch": "2023-12-25"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
code: '<string>',
currency: '<string>',
servicePeriodStartDate: '2023-11-07T05:31:56Z',
servicePeriodEndDate: '2023-11-07T05:31:56Z',
billFrequency: '<unknown>',
billFrequencyInterval: 183,
billInAdvance: true,
chargeDescription: '<string>',
version: 123,
customFields: {},
amount: 1,
units: 123,
unitPrice: 123,
billEpoch: '2023-12-25'
})};
fetch('https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview', 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}/balances/{balanceId}/balancechargeschedules/preview",\
CURLOPT_RETURNTRANSFER => true,\
CURLOPT_ENCODING => "",\
CURLOPT_MAXREDIRS => 10,\
CURLOPT_TIMEOUT => 30,\
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
CURLOPT_CUSTOMREQUEST => "POST",\
CURLOPT_POSTFIELDS => json_encode([\
'name' => '<string>',\
'code' => '<string>',\
'currency' => '<string>',\
'servicePeriodStartDate' => '2023-11-07T05:31:56Z',\
'servicePeriodEndDate' => '2023-11-07T05:31:56Z',\
'billFrequency' => '<unknown>',\
'billFrequencyInterval' => 183,\
'billInAdvance' => true,\
'chargeDescription' => '<string>',\
'version' => 123,\
'customFields' => [\
\
],\
'amount' => 1,\
'units' => 123,\
'unitPrice' => 123,\
'billEpoch' => '2023-12-25'\
]),\
CURLOPT_HTTPHEADER => [\
"Authorization: Bearer <token>",\
"Content-Type: application/json"\
],\
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"currency\": \"<string>\",\n \"servicePeriodStartDate\": \"2023-11-07T05:31:56Z\",\n \"servicePeriodEndDate\": \"2023-11-07T05:31:56Z\",\n \"billFrequency\": \"<unknown>\",\n \"billFrequencyInterval\": 183,\n \"billInAdvance\": true,\n \"chargeDescription\": \"<string>\",\n \"version\": 123,\n \"customFields\": {},\n \"amount\": 1,\n \"units\": 123,\n \"unitPrice\": 123,\n \"billEpoch\": \"2023-12-25\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpResponse<String> response = Unirest.post("https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"currency\": \"<string>\",\n \"servicePeriodStartDate\": \"2023-11-07T05:31:56Z\",\n \"servicePeriodEndDate\": \"2023-11-07T05:31:56Z\",\n \"billFrequency\": \"<unknown>\",\n \"billFrequencyInterval\": 183,\n \"billInAdvance\": true,\n \"chargeDescription\": \"<string>\",\n \"version\": 123,\n \"customFields\": {},\n \"amount\": 1,\n \"units\": 123,\n \"unitPrice\": 123,\n \"billEpoch\": \"2023-12-25\"}")
.asString();
require 'uri'
require 'net/http'
url = URI("https://api.m3ter.com/organizations/{orgId}/balances/{balanceId}/balancechargeschedules/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"currency\": \"<string>\",\n \"servicePeriodStartDate\": \"2023-11-07T05:31:56Z\",\n \"servicePeriodEndDate\": \"2023-11-07T05:31:56Z\",\n \"billFrequency\": \"<unknown>\",\n \"billFrequencyInterval\": 183,\n \"billInAdvance\": true,\n \"chargeDescription\": \"<string>\",\n \"version\": 123,\n \"customFields\": {},\n \"amount\": 1,\n \"units\": 123,\n \"unitPrice\": 123,\n \"billEpoch\": \"2023-12-25\"}"
response = http.request(request)
puts response.read_body
200
4XX
5XX
{
"id": "<string>",
"chargeDescription": "<string>",
"version": 123,
"customFields": {},
"balanceId": "<string>",
"name": "<string>",
"code": "<string>",
"amount": 123,
"units": 123,
"unitPrice": 123,
"currency": "<string>",
"servicePeriodStartDate": "2023-11-07T05:31:56Z",
"servicePeriodEndDate": "2023-11-07T05:31:56Z",
"billEpoch": "2023-12-25",
"billFrequency": "<unknown>",
"billFrequencyInterval": 123,
"billInAdvance": true,
"dtCreated": "2023-11-07T05:31:56Z",
"dtLastModified": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedBy": "<string>",
"nextRun": "2023-11-07T05:31:56Z",
"previousRun": "2023-11-07T05:31:56Z"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
Authorizations
Authorization
string
header
required
m3ter supports machine to machine authentication using the clientCredentials OAuth2 flow.
The authorizationCode flow controls access for human users via the m3ter Console application.
Path Parameters
orgId
string
required
UUID of the organization
balanceId
string
required
UUID of the balance
Query Parameters
pageSize
integer
Number of Charges to retrieve per page
Required range: 1 <= x <= 200
nextToken
string
nextToken for multi page retrievals
Body
application/json
name
string
required
The name of the Balance Charge Schedule.
Required string length: 1 - 200
code
string
required
Unique short code for the Balance Charge Schedule.
Required string length: 1 - 80
Pattern: ^([^[\p{Cntrl}\s]])|([^[\p{Cntrl}\s]][[^[\p{Cntrl}\s]] ]*[^[\p{Cntrl}\s]])$
currency
string
required
The currency of the Charges created by the Balance Charge Schedule.
servicePeriodStartDate
string
required
The service period start date ( in ISO-8601 format) of the Balance Charge Schedule.
servicePeriodEndDate
string
required
The service period end date ( in ISO-8601 format) of the Balance Charge Schedule.
billFrequency
any
required
billFrequencyInterval
integer
required
How often Bills are issued. For example, if billFrequency is MONTHLY and billFrequencyInterval is 3, Bills are issued every three months.
Required range: 1 <= x <= 365
billInAdvance
boolean
required
Used to specify how Charges created by the Balance Charge Schedule are billed - either in arrears or in advance:
- Use
falsefor billing in arrears. - Use
truefor billing in advance.
chargeDescription
string
required
The description for Charges created by the Balance Charge Schedule. Used on Bills for Charge line items.
Minimum string length: 1
version
integer
The version number of the entity:
- Create entity: Not valid for initial insertion of new entity - do not use for Create. On initial Create, version is set at 1 and listed in the response.
- Update Entity: On Update, version is required and must match the existing version because a check is performed to ensure sequential versioning is preserved. Version is incremented by 1 and listed in the response.
customFields
object
User defined fields enabling you to attach custom data. The value for a custom field can be either a string or a number.
amount
number
The amount of each Charge created by the Balance Charge Schedule. Must be omitted if units and unitPrice are provided.
Required range: x >= 0
units
number
Number of units defined for the Charges created by the Schedule. Required when unitPrice is provided. Must be omitted when amount is used.
unitPrice
number
Unit price for Charge. Must be provided when units is used. Must be omitted when amount is used.
billEpoch
string
Specify a billing cycle date ( in ISO-8601 format) for when the first Bill is created for Balance Charges created by the Schedule, and also acts as a reference for when in the Schedule period subsequent Bills are created for the defined billFrequency. If left blank, then the relevant Epoch date from your Organization's configuration will be used as the billing cycle date instead.
Response
200
application/json
Return the list of BalanceCharges this request would create
id
string
required
The UUID of the entity.
chargeDescription
string
required
The description for Charges created by the Balance Charge Schedule. Used on Bills for Charge line items.
version
integer
The version number:
- Create: On initial Create to insert a new entity, the version is set at 1 in the response.
- Update: On successful Update, the version is incremented by 1 in the response.
customFields
object
User defined fields enabling you to attach custom data. The value for a custom field can be either a string or a number.
balanceId
string
The unique identifier (UUID) for the Balance this Balance Charge Schedule was created for.
name
string
The name of the Balance Charge Schedule.
code
string
Unique short code for the Balance Charge Schedule.
amount
number
The amount of each Charge created by the Balance Charge Schedule.
units
number
Number of units. If the Charge was created with amount only, then will be null.
unitPrice
number
Unit price. If the Charge was created with amount only, then will be null.
currency
string
The currency of the Charges created by the Balance Charge Schedule.
servicePeriodStartDate
string
The service period start date ( in ISO-8601 format) of the Balance Charge Schedule.
servicePeriodEndDate
string
The service period end date ( in ISO-8601 format) of the Balance Charge Schedule.
billEpoch
string
Specifies a billing cycle date ( in ISO-8601 format) for when the first Bill is generated for Balance Charges created by the Schedule, and also acts as a reference for when in the Schedule period subsequent Bills are created for the defined billFrequency. If blank, then the relevant Epoch date from your Organization's configuration is used.
billFrequency
any
billFrequencyInterval
integer
How often Bills are issued. For example, if billFrequency is MONTHLY and billFrequencyInterval is 3, Bills are issued every three months.
billInAdvance
boolean
Specifies how Charges created by the Balance Charge Schedule are billed - either in arrears or in advance:
- If
falsethen billing is in arrears. - If
truethen billing is in advance.