Salta al contenuto principale

Use Api to create custom plan

Thread needs solution
Beginner
Messaggi: 1
Commenti: 0

Hey hi.

I want to use API to create plan with full backups in every monday and friday and incremental backups in left days, but I don't understand how to do this via API. I set "subject.policy.settings.scheduling.schema" to "custom", then I add next backup sets

{
                                    "type": "full",
                                    "schedule":{
                                        "alarms": {
                                            "time": {
                                                "weekdays": [
                                                    "mon",
                                                    "fri"
                                                ],
                                                "repeat_at": [
                                                    {
                                                        "hour": 21,
                                                        "minute": 0
                                                    }
                                                ]
                                            }
                                        },
                                        "conditions": {},
                                        "prevent_sleep": true,
                                        "type": "daily"
                                    }
                                },
                                {
                                    "type": "incremental",
                                    "schedule": {
                                        "alarms": {
                                            "time": {
                                                "weekdays": [
                                                    "tue",
                                                    "wed",
                                                    "thu",
                                                    "sat",
                                                    "sun"
                                                ],
                                                "repeat_at": [
                                                    {
                                                        "hour": 21,
                                                        "minute": 0
                                                    }
                                                ]
                                            }
                                        },
                                        "conditions": {},
                                        "prevent_sleep": true,
                                        "type": "daily"
                                    }
                                }

 

to "subject.policy.settings.scheduling.backup_sets". But request with this body returns error

{"domain":"BackupManager","code":"InvalidRequestBody","reason":"InvalidRequestBody","context":{"stackTrace":"[grpm.go:1147 grpm.go:1120 context.go:442 grpm.go:1108 grpm.go:829 handler.go:172 asm_amd64.s:1357]"},"debug":{"msg":"Unsupported backup kind incremental"},"message":"Unsupported backup kind incremental"}

Sorry. I don't know how to format code above

0 Users found this helpful
Acronis engineer
Messaggi: 0
Commenti: 84

Hello Danil,

The JSON format with all settings and available values for each setting is described at https://developer.acronis.com/doc/resource-policy-management/v4/guide/p… where you need to expand the Policy example to see the JSON scheme.

"type": "incremental" is not a valid value just how the error suggests

As seen from the JSON scheme:

# A backup scheme. Available values: ``simple``, ``always_full``, ``always_incremental``, ``weekly_incremental``, ``weekly_full_daily_incremental``, ``custom``, ``cdp``.

"incremental" is not a valid value

However in your specific scenario this still doesn't help as we don't have the exact custom scheme documented, with mixed Full and Incremental backups on different days. It is possible, in this case the correct non-documented value is "incr" and you can try below "scheduling" block with your call, just add it to your JSON inside the "settings" block.

You can use the WebUI to create a protection plan by your own custom setup, then pull the list of policies https://developer.acronis.com/doc/resource-policy-management/v4/referen… with the include_settings=true parameter added to the call or even pull the exact policy with same parameter with GET /api/policy_management/v4/policies/{policy_id}?include_settings=true then grab the JSON's "settings" object or any other object from the JSON scheme and build your own JSON template that you'll later use via API. Just an advise as we don't have all documented scenarios but this way you can check all settings with their values under our API and use them in your JSON.

Here is the "scheduling" block part of the JSON that should fix your issue:

"scheduling": {
                        "backup_sets": [
                            {
                                "type""full",
                                "schedule": {
                                    "alarms": {
                                        "time": {
                                            "weekdays": [
                                                "mon",
                                                "fri"
                                            ],
                                            "repeat_at": [
                                                {
                                                    "hour"17,
                                                    "minute"45
                                                }
                                            ]
                                        }
                                    },
                                    "conditions": {},
                                    "prevent_sleep"true,
                                    "type""weekly"
                                }
                            },
                            {
                                "type""incr",
                                "schedule": {
                                    "alarms": {
                                        "time": {
                                            "weekdays": [
                                                "sun",
                                                "tue",
                                                "wed",
                                                "thu",
                                                "sat"
                                            ],
                                            "repeat_at": [
                                                {
                                                    "hour"17,
                                                    "minute"45
                                                }
                                            ]
                                        }
                                    },
                                    "conditions": {},
                                    "prevent_sleep"true,
                                    "type""weekly"
                                }
                            }
                        ],
                        "enabled"true,
                        "max_parallel_backups"2,
                        "rand_max_delay": {
                            "type""minutes",
                            "count"30
                        },
                        "scheme""custom",
                        "task_failure": {
                            "enabled"false,
                            "interval": {
                                "type""hours",
                                "count"1
                            },
                            "max_attempts"1
                        },
                        "weekly_backup_day""mon"
                    }
 
Let me know if that helps and feel free to post back in case you have other questions around your exact scenario.
 
Thank you.