The api spec states that it requires a 24 char hexadecimal string. When I try this I get the following 400 error
{"detail":"The policy id 000000000000000000000001 is invalid.","error":400,"errorCode":"INVALID_POLICY_ID","parameters":["000000000000000000000001"],"reason":"Bad Request"}%
My curl request looks as follows
curl --user "\<public-api-key\>:\<private-api-key\><private-api-key>" --digest --include \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
> --request PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/<redacted\>/clusters/\<redacted>/backup/schedule" \
--data '
{
"referenceHourOfDay": 12,
"referenceMinuteOfHour": 30,
"policies": [
{
"id": "000000000000000000000001",
"policyItems": [
{
"frequencyType": "HOURLY",
"frequencyInterval": 6,
"retentionValue": 2,
"retentionUnit": "DAYS"
}
]
}
],
"updateSnapshots": true,
"autoExportEnabled" : true
}'
I get the same error when using the Cloudformation resource as follows:
new CfnResource(this, 'mongodb_backup_schedule', {
type: 'MongoDB::Atlas::CloudBackupSchedule',
properties: {
ProjectId: mongoproject.ref,
ClusterName: "<redacted>",
UseOrgAndGroupNamesInExportPrefix: true,
AutoExportEnabled: "false",
ApiKeys: {
PublicKey: '{{resolve:secretsmanager:atlas/<redacted>/apiKey:SecretString:publicKey}}',
PrivateKey: '{{resolve:secretsmanager:atlas/<redacted>/apiKey:SecretString:privateKey}}',
},
"Policies": [
{
"ID": "000000000000000000000001",
"PolicyItems": [
{
"FrequencyInterval": 6,
"FrequencyType": "hourly",
"RetentionUnit": "days",
"RetentionValue": 7
}
]
}
],
ReferenceHourOfDay: "0",
ReferenceMinuteOfHour: "0",
RestoreWindowDays: "1",
},
});
resulting in:
Resource handler returned message: "Error updating cloud backup schedule : PATCH https://cloud.mongodb.com/api/atlas/v1.0/groups/<redacted>/clusters/<redacted>/backup/schedule: 400 (request "INVALID_POLICY_ID") The policy id 000000000000000000000001 is invalid." (RequestToken: 2493f47d-d21d-8ca4-179c-e6874210c26d, HandlerErrorCode: InvalidRequest)
Can someone tell me what the correct constraints for the POLICY_ID are?
I’m basing my code on api spec described here MongoDB Atlas Administration API
Kind regards