title: Using mongodb ops manager REST API to perform a switchover
body: <p>I have written a python script (and an ansible playbook due to not being able to make the script work, but that's a different story) whose purpose is to perform a switchover within a mongodb replica set that is managed by ops manager, version 3.6. I have two sites, 3 servers in one site and 2 sites in the other, and what that script does basically is sent a PUT request to edit the automation configuration of the replica set and, depending on which site given, change the wanted server's priority to 2 while leaving the others at 1 and adding arbiters then deleting them if necessary. For now the purpose is just to change the priority with the put request to try and make it work, here is what the PUT request looks like:</p>
  
  <pre><code>data = {"replicaSets": [
  {
       "_id"_: "PP_ATLAS",
       "members": [
            {
                 "_id": 2,
                "host": "*servername*",
                "priority": 2,
            },
            {
                "_id": 3,
                "host": "*servername*",
            },
            {
                "_id": 4,
                "host": "*servername*",
            }
       ]
     }
  ],
  }
  headers = {'Content-Type': 'application/json'}
  js = requests.put(url, auth=HTTPDigestAuth (MMS_User, MMS_API), data=json.dumps(data), headers=headers, verify=False)
  </code></pre>
  
  <p>MMS_User and MMS_API are the identification tokens used in order to access the ops manager, also known as MMS.</p>
  
  <p>When I attempt this (the script requests a server name to switchover to as an argument), I recieve:</p>
  
  <pre><code>{"detail":"Invalid automation config: Process *servername that was given as an argument* referenced in one or more deployment items but not found in configuration.","error":400,"errorCode":null,"parameters":null,"reason":"Bad Request"}
  400
  </code></pre>
  
  <p>The <em>servername that was given as an argument</em> is what it says, not the actual quote "servername that was given as an argument".</p>