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 "< 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,
  "parameters" : [ "delivery" ],
  "reason" : "Bad Request"

this is the reference:

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:, 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.