Update Bill Status - m3ter Documentation
Update Bill Status
cURL
curl --request PUT \
--url https://api.m3ter.com/organizations/{orgId}/bills/{id}/status \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'
Python
import requests
url = "https://api.m3ter.com/organizations/{orgId}/bills/{id}/status"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
JavaScript
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://api.m3ter.com/organizations/{orgId}/bills/{id}/status', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/bills/{id}/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([]),
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;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/bills/{id}/status"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", 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))
}
Unirest
HttpResponse<String> response = Unirest.put("https://api.m3ter.com/organizations/{orgId}/bills/{id}/status")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{}").asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.m3ter.com/organizations/{orgId}/bills/{id}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
Response Codes
JSON Responses
{
"id": "<string>",
"version": 123,
"accountId": "<string>",
"accountCode": "<string>",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"startDateTimeUTC": "2023-11-07T05:31:56Z",
"endDateTimeUTC": "2023-11-07T05:31:56Z",
"billDate": "2023-12-25",
"dueDate": "2023-12-25",
"billFrequencyInterval": 123,
"timezone": "UTC",
"currency": "<string>",
"locked": true,
"createdDate": "2023-11-07T05:31:56Z",
"billJobId": "<string>",
"currencyConversions": [
{
"from": "EUR",
"to": "USD",
"multiplier": 1.12
}
],
"lastCalculatedDate": "2023-11-07T05:31:56Z",
"lineItems": [
{
"description": "<string>",
"quantity": 123,
"units": 123,
"unit": "<string>",
"subtotal": 123,
"currency": "<string>",
"conversionRate": 123,
"convertedSubtotal": 123,
"averageUnitPrice": 123,
"id": "<string>",
"productId": "<string>",
"productName": "<string>",
"productCode": "<string>",
"accountingProductId": "<string>",
"accountingProductName": "<string>",
"accountingProductCode": "<string>",
"aggregationId": "<string>",
"compoundAggregationId": "<string>",
"counterId": "<string>",
"chargeId": "<string>",
"segment": {},
"group": {},
"meterId": "<string>",
"planId": "<string>",
"planGroupId": "<string>",
"commitmentId": "<string>",
"balanceId": "<string>",
"creditTypeId": "<string>",
"pricingId": "<string>",
"childAccountId": "<string>",
"childAccountCode": "<string>",
"usagePerPricingBand": [
{
"pricingBandId": "<string>",
"lowerLimit": 123,
"fixedPrice": 123,
"unitSubtotal": 123,
"unitPrice": 123,
"bandUnits": 123,
"bandQuantity": 123,
"bandSubtotal": 123,
"creditTypeId": "<string>",
"convertedBandSubtotal": 123
}
],
"servicePeriodStartDate": "2023-11-07T05:31:56Z",
"servicePeriodEndDate": "2023-11-07T05:31:56Z",
"referencedBillId": "<string>",
"referencedLineItemId": "<string>",
"reasonId": "<string>",
"contractId": "<string>",
"sequenceNumber": 123,
"additional": {},
"grantDrawdowns": [
{
"balanceId": "<string>",
"quantity": 123,
"units": 123,
"currencyAmount": 123
}
],
"balanceDrawdowns": [
{
"balanceId": "<string>",
"units": 123,
"balanceAmount": 123,
"lineItemAmount": 123,
"billAmount": 123
}
],
"commitmentDrawdowns": [
{
"commitmentId": "<string>",
"units": 123,
"commitmentAmount": 123,
"lineItemAmount": 123,
"billAmount": 123
}
],
"creditCoverage": [
{
"lineItemId": "<string>",
"units": 123,
"lineItemAmount": 123,
"creditAmount": 123,
"billAmount": 123
}
]
}
],
"purchaseOrderNumber": "<string>",
"externalInvoiceReference": "<string>",
"externalInvoiceDate": "2023-12-25",
"jsonStatementGenerated": true,
"csvStatementGenerated": true,
"statementStale": true,
"billTotal": 123,
"totalDebits": 123,
"totalCredits": 123,
"sequentialInvoiceNumber": "<string>",
"dtCreated": "2023-11-07T05:31:56Z",
"dtLastModified": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedBy": "<string>",
"dtApproved": "2023-11-07T05:31:56Z",
"approvedBy": "<string>",
"dtLocked": "2023-11-07T05:31:56Z",
"lockedBy": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>"
}
Authorizations
- Authorization: required (string, header) – 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: required (string) - The unique identifier (UUID) of your Organization. The Organization represents your company as a direct customer of our service.
- id: required (string) - The unique identifier (UUID) of the Bill whose status you want to update.
Body
- status: required (enum) - The new status you want to assign to the Bill. Must be one of "Pending" or "Approved".
- Available options:
PENDING, APPROVED.
Response
- 200: application/json - Returns the updated Bill.