Nav

Create or Update a File or Directory

The POST operation creates or updates a file or directory on the server relative to CATALINA_BASE. URLs are of the form http://localhost:8080/console/api/servers/73d89173-290e-4cb3-a61c-e11deb74767d/files/<path>; where <path> is the path of the file you want to create or update. The request body, if any, contains the file. To create a directory on the server, also pass a request parameter directory=true, and send an empty request body.

Example request to create or update a file:


       
    
1
2
3
4
5
6
POST http://localhost:8080/console/api/servers/local$d6f9cf62-f09c-4bf6-9d73-a16fec39dffc/files/conf/server.xml HTTP/1.1
Content-Type: application/octet-stream
  
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
....

Example Response:


       
    
1
2
3
4
5
200 OK
Content-Length: 0
Content-Type: application/json
Server: Apache-Coyote/1.1
Date: Tue, 28 Jul 2015 16:17:12 GMT

Example request to create a directory:


       
    
1
2
3
POST http://localhost:8080/console/api/servers/local$d6f9cf62-f09c-4bf6-9d73-a16fec39dffc/files/new-directory?directory=true HTTP/1.1
Content-Type: application/octet-stream
Content-Length: 0

Example Response:


       
    
1
2
3
4
5
200 OK
Content-Length: 0
Content-Type: application/json
Server: Apache-Coyote/1.1
Date: Tue, 28 Jul 2015 16:17:12 GMT