title: Deploying/Updating Marathon Docker image using API
body: <p>I am writing code to update deployed image on marathon automatically. I use the REST patch method as listed in marathon API reference <a href="http://mesosphere.github.io/marathon/api-console/index.html" rel="nofollow noreferrer">http://mesosphere.github.io/marathon/api-console/index.html</a></p>
  
  <pre><code>    url = 'https://&lt;my-hostname&gt;:&lt;my-port&gt;/v2/apps'
      h = {'Content-type': 'application/json', 'Accept': 'application/json'}
      data = {'app': { "id": app,
                  'container': {
                      'docker': {
                          'image': image}}}}
      print ('requests.patch(%s, %s)' % (url + app, json.dumps(data)))
      r = requests.patch(url + app, headers = h, auth = auth, data = json.dumps(data))
      if r.status_code == 200:
          print('Deployed %s' % app)
  </code></pre>
  
  <p>The code ran successfully, I got back a Deployment ID, but nothing was changed from the UI. No new deployment is happening. If I change the patch request into get request without the data, I get back the image I previous updated in using code above.</p>
  
  <p>According to this similar API reference <a href="https://docs.mesosphere.com/1.11/deploying-services/marathon-api/#/apps/V2AppsByAppId1" rel="nofollow noreferrer">https://docs.mesosphere.com/1.11/deploying-services/marathon-api/#/apps/V2AppsByAppId1</a></p>
  
  <p>It says " This operation will create a deployment" but nothing happened. From the Marathon GUI, I don't see the configuration getting changed at all. If I restart, it is the same old deployment getting restarted. Am I interpreting the API reference incorrectly?</p>