Create Schedule - m3ter Documentation
Create Schedule
cURL Example
curl --request POST \
--url https://api.m3ter.com/organizations/{orgId}/dataexports/schedules \
--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 Example
import requests
url = "https://api.m3ter.com/organizations/{orgId}/dataexports/schedules"
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.post(url, json=payload, headers=headers)
print(response.text)
JavaScript (fetch) Example
const options = {
method: 'POST',
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', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP Example
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.m3ter.com/organizations/{orgId}/dataexports/schedules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
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;
}
Go Example
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.m3ter.com/organizations/{orgId}/dataexports/schedules"
payload := strings.NewReader(`{
"name": "<string>",
"code": "<string>",
"sourceType": "<unknown>",
"operationalDataTypes": [],
"version": 123,
"destinationIds": ["<string>"],
"scheduleType": "<string>",
"period": 2,
"offset": 2,
"cronExpression": "<string>",
"exportFileFormat": "<unknown>"
}`)
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))
}
Expected Response
A successful response returns a JSON object with the created Export Schedule:
{
"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": []
}
Error Responses
On error, the response might return:
{
"message": "<string>"
}