Update Schedule - m3ter Documentation
Update Schedule
cURL
curl --request PUT \
--url https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"code": "<string>",
"sourceType": "<unknown>",
"operationalDataTypes": [],
"version": 123,
"destinationIds": [
"<string>"
],
"scheduleType": "<string>",
"period": 2,
"offset": 2,
"cronExpression": "<string>",
"exportFileFormat": "<unknown>"
}
'
Python
import requests
url = "https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{id}"
payload = {
"name": "<string>",
"code": "<string>",
"sourceType": "<unknown>",
"operationalDataTypes": [],
"version": 123,
"destinationIds": ["<string>"],
"scheduleType": "<string>",
"period": 2,
"offset": 2,
"cronExpression": "<string>",
"exportFileFormat": "<unknown>"
}
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({
name: '<string>',
code: '<string>',
sourceType: '<unknown>',
operationalDataTypes: [],
version: 123,
destinationIds: ['<string>'],
scheduleType: '<string>',
period: 2,
offset: 2,
cronExpression: '<string>',
exportFileFormat: '<unknown>'
})
};
fetch('https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{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}/dataexports/schedules/{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([
'name' => '<string>',
'code' => '<string>',
'sourceType' => '<unknown>',
'operationalDataTypes' => [],
'version' => 123,
'destinationIds' => ['<string>'],
'scheduleType' => '<string>',
'period' => 2,
'offset' => 2,
'cronExpression' => '<string>',
'exportFileFormat' => '<unknown>'
]),
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;
}
Golang
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"sourceType\": \"<unknown>\",\n \"operationalDataTypes\": [],\n \"version\": 123,\n \"destinationIds\": [\n \"<string>\"\n ],\n \"scheduleType\": \"<string>\",\n \"period\": 2,\n \"offset\": 2,\n \"cronExpression\": \"<string>\",\n \"exportFileFormat\": \"<unknown>\"}")
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 (Java)
HttpResponse<String> response = Unirest.put("https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"sourceType\": \"<unknown>\",\n \"operationalDataTypes\": [],\n \"version\": 123,\n \"destinationIds\": [\n \"<string>\"\n ],\n \"scheduleType\": \"<string>\",\n \"period\": 2,\n \"offset\": 2,\n \"cronExpression\": \"<string>\",\n \"exportFileFormat\": \"<unknown>\"}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.m3ter.com/organizations/{orgId}/dataexports/schedules/{id}")
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 = "{\n \"name\": \"<string>\",\n \"code\": \"<string>\",\n \"sourceType\": \"<unknown>\",\n \"operationalDataTypes\": [],\n \"version\": 123,\n \"destinationIds\": [\n \"<string>\"\n ],\n \"scheduleType\": \"<string>\",\n \"period\": 2,\n \"offset\": 2,\n \"cronExpression\": \"<string>\",\n \"exportFileFormat\": \"<unknown>\"}"
response = http.request(request)
puts response.read_body
Response
Example Response (Success)
{
"id": "<string>",
"version": 123,
"name": "<string>",
"code": "<string>",
"sourceType": "<unknown>",
"destinationIds": [
"<string>"
],
"scheduleType": "<unknown>",
"period": 123,
"offset": 123,
"cronExpression": "<string>",
"exportFileFormat": "<unknown>",
"dtCreated": "2023-11-07T05:31:56Z",
"dtLastModified": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"lastModifiedBy": "<string>",
"operationalDataTypes": []
}
Example Response (Error)
{
"message": "<string>"
}
API Parameters
Path Parameters
orgId: UUID of the organization (required)
id: The UUID of the Schedule to update (required)
Body
{
"name": "<string>",
"code": "<string>",
"sourceType": "<unknown>",
"operationalDataTypes": [],
"version": 123,
"destinationIds": ["<string>"],
"scheduleType": "<string>",
"period": 2,
"offset": 2,
"cronExpression": "<string>",
"exportFileFormat": "<unknown>"
}
Response Example
- On successful update, returns the updated Data Export Schedule.
- Includes fields such as id, version, name, etc.