Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Orion/Server API/Transfer API"
< Orion | Server API
(→Starting a file upload) |
|||
Line 12: | Line 12: | ||
| reqhead = /xfer/MyProj/SomeFolder | | reqhead = /xfer/MyProj/SomeFolder | ||
Slug: MyTitle | Slug: MyTitle | ||
− | X- | + | X-Xfer-Content-Length: 901024 |
| resphead = 200 OK | | resphead = 200 OK | ||
Location: /xfer/import/23A43 | Location: /xfer/import/23A43 |
Revision as of 17:28, 17 January 2011
Under Construction: This API is not yet implemented
The transfer API is used for batch import and export of directory trees to/from an Orion workspace.
Import
Starting a file upload
- Overview
- An upload is initiated via a POST request. The request URL indicates where the file should be located once the upload is complete. The request must indicate the total size of the file the server should expect.
- HTTP Method
- POST
- Example Request
POST /xfer/MyProj/SomeFolder
Slug: MyTitle
X-Xfer-Content-Length: 901024
- Example Response
HTTP/1.1 200 OK
Location: /xfer/import/23A43
- Detailed Explanation
- The Location header in the response indicates the URL where chunks of the file should be uploaded. Once the server has received all chunks, the import into the workspace is completed. An upload that is not completed in a timely fashion from the initial POST is discarded by the server.
After initiating the transfer, uploads are performed as many times as required using PUT actions:
- Overview
- Uploads a chunk of a file to the server.
- HTTP Method
- PUT
- Example Request
PUT /xfer/import/23A43
Content-Length: 32768
Content-Type: application/zip
Content-Range: bytes 0-32767/901024
- Example Response
HTTP/1.1 308 Resume Incomplete
Range: bytes 0-30000
- Detailed Explanation
- A response of 308 indicates that the server has not yet received all required bytes, and the Range response header indicates the bytes known to the server so far. When the server has received all bytes, a 201 Created response is returned, with a Location header specifying the location of the newly added file or directory.
- POST request, returns a URI for resumable upload (uploading in chunks will allow for progress reporting). Request indicates whether we are uploading a file that should be stored directly in the workspace, or whether it is an archive that will need to be extracted into the workspace on the server.
- POST Response Location indicates upload URL
- Series of PUT requests to upload URL, using Content-Range header
- Responses indicate what total range server already knows
- Once server has all the bytes the file is stored or extracted into the workspace
Export
- GET request /xfer/export/<filename.zip>
- Request body contains:
- Array of files/directories to export - depth infinity is assumed, children should be listed independently if depth infinity is not desired
- Content type of response (zip, tar, etc)