File methods

26 views 0

Getting file (only returns information about the file)

PROPERTY VALUE
Synopsis GET /file/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500

Example Request: get information about the file /01/100001/example.com/index.html

          GET /file/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn
          {
          "name" : "index.html",
          "permissions" : 710,
          "folderpath" : "/01/100001/example.com",
          "owner" : 100001,
          "group" : 100001,
          "type" : "File"
          }

Deleting file

PROPERTY VALUE
Synopsis DELETE /file/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500

Example Request: delete file /01/100001/example.com/index.html

          DELETE /file/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Adding file

PROPERTY VALUE
Synopsis POST /file
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 409, 500

Example Request: add file /01/100001/example.com/index.html

          POST /file
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json
          {
          "name" : "index.html",
          "permissions" : 710,
          "folderpath" : "/01/100001/example.com",
          "owner" : 100001,
          "group" : 100001
          }

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Modifying file

PROPERTY VALUE
Synopsis PUT /file/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500

Example Request: modify file /01/100001/example.com/index.html

          GET /file/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json
          {
          "name" : "index.html",
          "permissions" : 777,
          "folderpath" : "/01/100001/example.com",
          "owner" : 100001,
          "group" : 100001
          }

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn
          {
          "name" : "index.html",
          "permissions" : 777,
          "folderpath" : "/01/100001/example.com",
          "owner" : 100001,
          "group" : 100001
          }

Call operation

PROPERTY VALUE
Synopsis POST /file/operation/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500
Operations GetFileContent, SetFileContent, CopyContentFromFile

Operation SetFileContent requires one more argument, content for the file. Operation CopyContentFromFile requires one more argument, path to the source file. Operation GetFileContent doesn’t require any additional arguments.

Example Request: set file content for the file: /01/100001/example.com/index.html

          GET /file/operation/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json
          {
          "operation" : "SetFileContent",
          "argument" : "some text"
          }

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Example Request: copy file content for the file: /01/100001/example.com/index.html

          GET /file/operation/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json
          {
          "operation" : "CopyContentFromFile",
          "argument" : "/00/100000/default.index.html"
          }

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Example Request: get file content for the file: /01/100001/example.com/index.html

          GET /file/operation/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json
          {
          "operation" : "GetFileContent"
          }

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn
          {
            "file content"
          }

Committing file action

PROPERTY VALUE
Synopsis GET /file/commit/{action}/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500
Action Previous action that was executed, values are: add, delete or modify.

Example Request: commit after delete action on file /01/100001/example.com/index.html

          GET /file/commit/delete/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Rollback file action

PROPERTY VALUE
Synopsis GET /file/rollback/{action}/{fileId}
Response Headers Content-Length, Content-Type
Response Status 200, 400, 404, 500
Action Previous action that was executed, values are: add, delete or modify.

Example Request: rollback after delete action on file /01/100001/example.com/index.html

          GET /file/rollback/delete/%2F01%2F100001%2Fexample.com%2Findex.html
          Host: {IP}
          Authorization: Basic xxxxxxxxxxxxxxxxxxx
          Accept: application/json

Example Response:

          HTTP/1.1 200 OK
          Content-Type: application/json
          Content-Length: nnn

Was this helpful?