The following HTTP methods can be used to perform file upload and download:
POST /uploads // Simple upload
GET /uploads/{fileId} // Simple downloadThe following HTTP methods can be used to perform file upload and download, and to manage sessions:
GET /sessions // Get data of all sessions
GET /sessions/{sessionId} // Get data of a single session
GET /sessions/{sessionId}/files // Get all files of a session
GET /sessions/{sessionId}/files/{fileId}/tokens/{tokenId} // Download a single file
POST /sessions // Create a new session
POST /sessions/{fileId} // Create an upload URL
POST /sessions/{sessionId}/files // Create a new file entry
POST /sessions/{sessionId}/files/{fileId}/tokens // Generate a download token
PUT /sessions/{sessionId}/files/{fileId} // Upload and store a file
DELETE /sessions/{sessionId} // Delete a session
DELETE /sessions/{sessionId}/files/{fileId} // Delete a filecurl -i -X POST --insecure --form file=@/tmp/test.txt --form --user 'foo:bar' http://127.0.0.1:3001/uploads
The parameter file defines the path to the desired file that should be uploaded.
| caution | |
This upload parameter is mandatory! |
Curl example:
curl -i -X POST --insecure --form file=@/tmp/test.txt http://127.0.0.1:3001/uploads
The parameter user defines the user to authenticate with the fileshare service.
| caution | |
This upload parameter is mandatory! |
curl -i -X POST --insecure --form --user 'foo:bar' http://127.0.0.1:3001/uploads
The parameter ttl defines the time-to-live (in seconds), that is how long the uploaded file will be available for download. The default values for this parameter are defined in the configuration file:
models: {
session: {
ttl: 86400 * 7
},
upload: {
ttl: 3600
}
}Curl example:
curl -i -X POST --insecure --form file=@/tmp/test.txt --form ttl=3600 --user 'foo:bar' http://127.0.0.1:3001/uploads
Response from curl when TTL is expired:
{
"message": "upload expired"
}Response in the log file when TTL is expired:
Error at /uploads/88e5905d-5d96-4750-ab3d-77a1ed26f569: message=upload expired, status=410
There is a significant difference in the usage of the filesharing service between the approach within the RTC:engine and the simple upload/download one: