Update Plan - m3ter Documentation
Update Plan
cURL
curl --request PUT \
--url https://api.m3ter.com/organizations/{orgId}/plans/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"planTemplateId": "<string>",
"name": "<string>",
"code": "<string>",
"version": 123,
"customFields": {},
"standingCharge": 1,
"standingChargeDescription": "<string>",
"ordinal": 1,
"bespoke": true,
"minimumSpend": 1,
"minimumSpendDescription": "<string>",
"standingChargeBillInAdvance": true,
"minimumSpendBillInAdvance": true,
"minimumSpendAccountingProductId": "<string>",
"standingChargeAccountingProductId": "<string>",
"accountId": "<string>"
}
'
Python Example
import requests
url = "https://api.m3ter.com/organizations/{orgId}/plans/{id}"
payload = {
"planTemplateId": "<string>",
"name": "<string>",
"code": "<string>",
"version": 123,
"customFields": {},
"standingCharge": 1,
"standingChargeDescription": "<string>",
"ordinal": 1,
"bespoke": True,
"minimumSpend": 1,
"minimumSpendDescription": "<string>",
"standingChargeBillInAdvance": True,
"minimumSpendBillInAdvance": True,
"minimumSpendAccountingProductId": "<string>",
"standingChargeAccountingProductId": "<string>",
"accountId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)
JavaScript Example
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
planTemplateId: '<string>',
name: '<string>',
code: '<string>',
version: 123,
customFields: {},
standingCharge: 1,
standingChargeDescription: '<string>',
ordinal: 1,
bespoke: true,
minimumSpend: 1,
minimumSpendDescription: '<string>',
standingChargeBillInAdvance: true,
minimumSpendBillInAdvance: true,
minimumSpendAccountingProductId: '<string>',
standingChargeAccountingProductId: '<string>',
accountId: '<string>'
})
};
fetch('https://api.m3ter.com/organizations/{orgId}/plans/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP Example
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/plans/{id}",
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([
'planTemplateId' => '<string>',
'name' => '<string>',
'code' => '<string>',
'version' => 123,
'customFields' => [],
'standingCharge' => 1,
'standingChargeDescription' => '<string>',
'ordinal' => 1,
'bespoke' => true,
'minimumSpend' => 1,
'minimumSpendDescription' => '<string>',
'standingChargeBillInAdvance' => true,
'minimumSpendBillInAdvance' => true,
'minimumSpendAccountingProductId' => '<string>',
'standingChargeAccountingProductId' => '<string>',
'accountId' => '<string>'
]),
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;
}
?>
GOP Example
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/plans/{id}"
payload := strings.NewReader("{\n \"planTemplateId\": \"<string>\",\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"version\": 123,\n \"customFields\": {},\n \"standingCharge\": 1,\n \"standingChargeDescription\": \"<string>\",\n \"ordinal\": 1,\n \"bespoke\": true,\n \"minimumSpend\": 1,\n \"minimumSpendDescription\": \"<string>\",\n \"standingChargeBillInAdvance\": true,\n \"minimumSpendBillInAdvance\": true,\n \"minimumSpendAccountingProductId\": \"<string>\",\n \"standingChargeAccountingProductId\": \"<string>\",\n \"accountId\": \"<string>\"}")
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))
}
Response
Success (200)
{
"id": "<string>",
"version": 123,
"customFields": {},
"planTemplateId": "<string>",
"productId": "<string>",
"name": "<string>",
"code": "<string>",
"standingCharge": 123,
"standingChargeDescription": "<string>",
"ordinal": 123,
"bespoke": true,
"minimumSpend": 123,
"minimumSpendDescription": "<string>",
"standingChargeBillInAdvance": true,
"minimumSpendBillInAdvance": true,
"minimumSpendAccountingProductId": "<string>",
"standingChargeAccountingProductId": "<string>",
"accountId": "<string>",
"dtCreated": "2023-11-07T05:31:56Z",
"dtLastModified": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedBy": "<string>"
}
Error (4XX/5XX)
{
"message": "<string>"
}