File Service Operations - Synergex/SqlReplication GitHub Wiki
The service supports the following operations:
Operation | HTTP Method | URI |
---|---|---|
Ping | GET | /FileService/ping |
List all files | GET | /FileService |
Check if a file exists | GET | /FileService/exists/filename.ext |
Download a text file | GET | /FileService/text/filename.ext |
Create a file | POST | /FileService/filename.ext |
Update a file | PUT | /FileService/filename.ext |
Delete a file | DELETE | /FileService/filename.ext |
For operations that return data, the format of that data is determined by the value of the HTTP request Accept header that you pass.
Response Format | MIME Type |
---|---|
JSON | application/json |
XML | application/xml |
This operation allows you to ping the server to verify that it is operating.
HTTP Method: GET
URI: /FileService/ping
Request headers: Host: <server_dns_or_ip>[:<port>]
Request body: None
Response headers: Content-Length: 25
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: A string containing the text "FileService Ping Response"
HTTP result codes: HTTP 200 (OK) response indicates a successful ping
This operation allows you to retrieve a list of all of the files that currently exist in the servers storage folder.
HTTP Method: GET
URI: /FileService
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Request body: None
Response headers: Content-Length: <int>
Content-Type: <mime_type>
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: A string containing a JSON or XML array of the names of the files in the server folder.
HTTP result codes: HTTP 200 (OK) indicates a successful response
This operation allows you to determine if a file with a specified name exists in the servers storage folder.
HTTP Method: GET
URI: /FileService/exists/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Request body: n/a
Response headers: Content-Length: 0
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: None
HTTP result codes: HTTP 204 (no content) indicates that the file exists.
HTTP 404 (not found) indicates that the file does not exist.
This operation allows you to download a copy of a named file from the servers storage folder.
HTTP Method: GET
URI: /FileService/text/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Request body: None
Response headers: Content-Length: <int>
Content-Type: <mime_type>
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: A JSON or XML array of strings containing the records from the text file.
HTTP result codes: HTTP 200 (OK) that the file exists and its content was returned in the response body.
HTTP 404 (not found) indicates that the file does not exist.
This operation allows you to create a new named file in the servers storage folder. If the file already exists the operation will fail.
HTTP Method: POST
URI: /FileService/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Content-Length: <int>
Content-Type: text/plain
Request body: A string containing the records from the text file.
Response headers: Content-Length: 0
Date: <date_time>
Location: <url_to_retrieve_file>
Server: Microsoft-HTTPAPI/2.0
ServerFileSpec: <file_spec>
Response body: None
HTTP result codes: HTTP 201 (created) indicates that the file was created.
HTTP 403 (forbidden) indicates that the file already existed and was NOT updated.
This operation allows you to create a new named file in the servers storage folder by uploading the file in several "chunks" which are appended together on the server to make a single file. This is useful when uploading very large files that would otherwise not be possible to process because of memory or network constraints.
A chunked upload takes place during a series of at least two web service calls.
- A mandatory call to start the chunked upload.
- Optionally, any number of calls to continue the upload.
- A mandatory call to finish the chunked upload.
This operation starts a new chunked upload. The first part of the files data is passed and is written to a new file on the server. If the file already exists then the operation will fail.
HTTP Method: POST
URI: /FileService/chunked/start/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Content-Length: <int>
Content-Type: text/plain
Request body: A string containing the first set of records from the text file.
Response headers: Content-Length: 0
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: None
HTTP result codes: HTTP 204 (no content) indicates that the first part of the file was created.
HTTP 403 (forbidden) indicates that the file already existed and was NOT updated.
This operation continues a chunked upload. The next part of the files data is passed and is appended to the existing file on the server.
HTTP Method: POST
URI: /FileService/chunked/continue/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Content-Length: <int>
Content-Type: text/plain
Request body: A string containing the next set of records from the text file.
Response headers: Content-Length: 0
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: None
HTTP result codes: HTTP 204 (no content) indicates that the data was appended to the file.
HTTP 400 (bad request) indicates that the file does not exist on the server.
This operation finishes a chunked upload. The final part of the files data is passed and is appended to the existing file on the server.
HTTP Method: POST
URI: /FileService/chunked/finish/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Accept: <mime_type>
Content-Length: <int>
Content-Type: text/plain
Request body: A string containing the final set of records from the text file.
Response headers: Content-Length: 0
Date: <date_time>
Location: <url_to_retrieve_file>
Server: Microsoft-HTTPAPI/2.0
ServerFileSpec: <file_spec>
Response body: None
HTTP result codes: HTTP 201 (created) indicates that the file was created.
HTTP 403 (forbidden) indicates that the file already existed and was NOT updated.
This operation allows you to update an existing file in the servers storage folder. If the file already exists it will be overwritten.
HTTP Method: PUT
URI: /FileService/
Request headers: Host: <server_dns_or_ip>[:<port>]
Content-Type: text/plain
Content-Length: <length>
Request body: A string containing the records from the text file.
Response headers: Content-Length: 0
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: None
HTTP result codes: HTTP 200 (OK) indicates that the file was created or updated.
This operation allows you to delete a file from the servers storage folder.
HTTP Method: DELETE
URI: /FileService/<filename>
Request headers: Host: <server_dns_or_ip>[:<port>]
Request body: None
Response headers: Content-Length: 0
Date: <date_time>
Server: Microsoft-HTTPAPI/2.0
Response body: None
HTTP result codes: HTTP 204 (No Content) indicates that the file was deleted