mongodb atlas api创建旧版备份还原作业

问题描述

我在项目C中有两个集群A和B。 A使用旧版备份,B使用云备份。

我正在尝试使用mongodb atlas API创建还原作业,以使A还原到B。 我的cli命令如下所示:

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"
       }'

我遇到这样的错误

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

这是参考:https://docs.atlas.mongodb.com/reference/api/legacy-backup/restore/create-one-restore-job/

有人可以帮助执行此命令吗?有什么不对吗?

更多详细信息:

  1. 我从UI运行,A可以还原到B。没关系,他们有不同的备份设置。
  2. 在参考示例中,它表示使用,其不正确的输出错误无法识别id,所以我改用了。
  3. 由于语法错误,其他人也遇到了类似的错误https://jira.mongodb.org/browse/DOCS-12396,但是我找不到命令中的错误

解决方法

嗨,我认为您使用了错误的语法。

参考:https://docs.atlas.mongodb.com/reference/api/cloud-backup/restore/create-one-restore-job/

{{1}}