mongodb atlas api Create Legacy Backup Restore Job

I have two clusters A and B in project C. A uses legacy backup and B uses cloud backup.

I am trying to use mongodb atlas API to create a restore job for A to restore to B. My cli command look like this:

curl --user "<public key>:<private key>" --digest \
     --header "Accept: application/json" \
     --header "Content-Type: application/json" \
     --request POST "https://cloud.mongodb.com/api/atlas/v1.0/groups/< C 's project id>/clusters/<A's cluster name>/restoreJobs?pretty=true" \
     --data '
       {
         "delivery" : {
           "methodName" : "AUTOMATED_RESTORE",
           "targetGroupId" : "< C 's project id>",
           "targetClusterId" : "<B's cluster name>"
         },
         "snapshotId": "XXXXX"
       }'

I got error like this:

{
  "detail" : "Received JSON for the delivery attribute does not match expected format.",
  "error" : 400,
  "errorCode" : "INVALID_JSON_ATTRIBUTE",
  "parameters" : [ "delivery" ],
  "reason" : "Bad Request"
}%

this is the reference: https://docs.atlas.mongodb.com/reference/api/legacy-backup/restore/create-one-restore-job/

can anyone help with this command? what is incorrect in it?

more details:

  1. I run from UI that A can restore to B. it doesn’t matter they have different backup settings.
  2. from reference example, it said using , its incorrect and output error can’t recognize id so I used instead.
  3. someone else also has a similar error I had because of syntax error: https://jira.mongodb.org/browse/DOCS-12396, but I cant find there is an error in my command.

Hi… it looks like you are using targetClusterId which is expecting the ID of the Cluster, you are using the ClusterName. If you want to use the cluster name, you would specify targetClusterName instead.