Contact Us 1-800-596-4880

Update a File

When called with the HTTP PUT operation, the resource /mmc/api/servers/<myServerId>/files/<myFile.xml>, updates a file on the server. The file location is considered relative to the Mule installation directory.

This resource has exactly the same semantics as when it is invoked with the POST command. However, instead of creating a new file if the file does not exist, when invoked with the PUT command it returns a 404 status code.

You specify URLs as http://localhost:8080/mmc/api/servers/73d89173-290e-4cb3-a61c-e11deb74767d/files/<path>; where <path> is the path to the file you want to update and 73d89173-290e-4cb3-a61c-e11deb74767d is the server id. The request body contains the new data for the file.

Example Request

The following code shows how to use the PUT command to invoke this request to update the myconfig.xml file.

PUT http://localhost:8080/mmc/api/servers/local$d6f9cf62-f09c-4bf6-9d73-a16fec39dffc/files/myconfig.xml
Content-Type: application/octet-stream

...file data...

Example Response

A successful update request returns a response such as the following:

200 OK
Content-Length: 0
Content-Type: application/json
Server: Apache-Coyote/1.1
Date: Tue, 10 Nov 2009 16:17:12 GMT