Change the cluster tier. PATCH request

I’m trying to update my cluster to M20 tier via API call
The URL
https://cloud.mongodb.com/api/atlas/v1.0/groups/myporojectID/clusters/myclusterName
The response is:

{
    "detail": "Unexpected error.",
    "error": 500,
    "errorCode": "UNEXPECTED_ERROR",
    "parameters": [],
    "reason": "Internal Server Error"
}

The API key has been created, also access/permissions granted
I’m using postman
The GET works fine
A JSON file as a body:

{
  "acceptDataRisksAndForceReplicaSetReconfig": "2019-08-24T14:15:22Z",
  "autoScaling": {
    "compute": {
      "enabled": true,
      "scaleDownEnabled": true
    },
    "diskGBEnabled": false
  },
  "backupEnabled": false,
  "biConnector": {
    "enabled": false,
    "readPreference": "PRIMARY"
  },
  "clusterType": "REPLICASET",
  "diskSizeGB": 32,
  "encryptionAtRestProvider": "NONE",
  "labels": [],
  "mongoDBMajorVersion": "4.4",
  "name": myclusterName,
  "numShards": 1,
  "paused": false,
  "pitEnabled": true,
  "providerBackupEnabled": true,
  "providerSettings": {
    "providerName": "AZURE",
    "autoScaling": {
      "compute": {
        "maxInstanceSize": "M50",
        "minInstanceSize": "M10"
      } 
    },
    "diskTypeName": "P4",
    "instanceSizeName": "M20",
    "regionName": "UK_SOUTH"
  },
  "replicationSpecs": [
    {
      "id": XXX,
      "numShards": 1,
      "regionsConfig": {
        "UK_SOUTH": {
          "analyticsNodes": 0,
          "electableNodes": 3,
          "priority": 7,
          "readOnlyNodes": 0
        }
      },
      "zoneName": "Zone 1"
    }
  ],
  "rootCertType": "ISRGROOTX1",
  "tags": [],
  "terminationProtectionEnabled": false,
  "versionReleaseSystem": "LTS"
}

One more question: where I should find “id”. I did GET request and took the id from answer. Is it possible to find via UI (portal) ?

Hi @Andrii_Tkachuk,

Can you try the update using the following Modify One Multi-Cloud Cluster from One Project request:

https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}

Note: The difference relative to your initial endpoint is a v2 instead of v1

Let me know if you’re still getting an error, if so, please send the full request details here. You can redact the groupId and clusterName before doing so.

Regards,
Jason

HI @Jason_Tran, thanks for replying
V2 (https://cloud.mongodb.com/api/atlas/v2/groups/myporojectID/clusters/myclusterName) returned

{
    "detail": "Invalid accept header or version date.",
    "error": 406,
    "errorCode": "INVALID_VERSION_DATE",
    "parameters": [],
    "reason": "Not Acceptable"
}

I’m using postman. The same result in python.
The full request in my first post

Are you following the request sample (request) as opposed to the response sample? The body you’ve provided looks to be the response. Refer to : Modify One Multi-Cloud Cluster from One Project

E.g (from the docs):
Payload:

Response:

I noticed your body you’ve provided in your initial response contains id, clusterName values which the payload doesn’t require. I think this also answers your question regarding the id. The id is in the response once the update request is sent.

Regards,
Jason

Hello @Jason_Tran
Payload

{
  "acceptDataRisksAndForceReplicaSetReconfig": "2019-08-24T14:15:22Z",
  "backupEnabled": false,
  "biConnector": {
    "enabled": false,
    "readPreference": "PRIMARY"
  },
  "clusterType": "REPLICASET",
  "diskSizeGB": 32,
  "encryptionAtRestProvider": "NONE",
  "labels": [],
  "mongoDBMajorVersion": "4.4",
  "name": "myclustername",
  "paused": false,
  "pitEnabled": true,
  "replicationSpecs": [
    {
      "numShards": 1,
      "regionConfigs": [
          {
          "providerName": "AZURE",
          "regionName": "UK_SOUTH",
          "analyticsNodes": 0,
          "electableNodes": 3,
          "priority": 7,
          "readOnlyNodes": 0,
          "analyticsSpecs": {
              "instanceSize": "M20"
            }
        }
      ],
      "zoneName": "Zone 1"
    }
  ],
  "rootCertType": "ISRGROOTX1",
  "tags": [],
  "terminationProtectionEnabled": false,
  "versionReleaseSystem": "LTS"
}

The URL
https://cloud.mongodb.com/api/atlas/v2/groups/myprojectId/clusters/myclustername

{
    "detail": "Invalid accept header or version date.",
    "error": 406,
    "errorCode": "INVALID_VERSION_DATE",
    "parameters": [],
    "reason": "Not Acceptable"
}

Thanks @Andrii_Tkachuk,

What’s the Accept value you’re using in Postman? I managed to get the same error in postman for my own test environment when using an Accept value of */*:

Upon changing the Accept value in postman to application/vnd.atlas.2023-02-01+json, the request went through.

For what it’s worth, here is the body of the request I tested:

{
  "backupEnabled": true,
  "clusterType": "REPLICASET",
  "diskSizeGB": 30,
  "mongoDBMajorVersion": "6.0",
  "name": "Cluster0",
  "replicationSpecs": [
    {
      "numShards": 1,
      "regionConfigs": [
        {
          "electableSpecs": {
            "diskIOPS": 0,
            "ebsVolumeType": "STANDARD",
            "instanceSize": "M20",
            "nodeCount": 3
          },
          "priority": 7,
          "providerName": "AWS",
          "regionName": "AP_SOUTHEAST_2"
        }
      ]
    }
  ],
  "rootCertType": "ISRGROOTX1",
  "terminationProtectionEnabled": false
}

Note: This is just a sample body that I had used for my test environment. I am not advising you to use this exact same request body.

Regards,
Jason

I just thought too, you could try running curl as well to see if you get same error. It could be related to the postman setup as opposed to the body details. Not mandatory but something to also help troubleshoot.

Regards,
Jason

Thank you @Jason_Tran
The solution is working
I changed one of headers:

Accept : application/vnd.atlas.2023-02-01+json

Removed:

"biConnector": {
    "enabled": false,
    "readPreference": "secondary"
},

Thanks!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.