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.
Session identification:
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/{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 fileSimple identification:
GET /uploads/{fileId} // Get uploaded file
POST /uploads // Upload filecurl -i -X POST --insecure --form file=@/tmp/test.txt --user 'myuser@example.com:mypass' \
https://$NGCP_IP:1446/rtc/fileshare/uploadsThe 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 https://$NGCP_IP:1446/rtc/fileshare/uploads
The parameter user defines the user to authenticate with the fileshare service.
| caution | |
This upload parameter is mandatory! |
curl -i -X POST --insecure --user 'foo:bar' https://$NGCP_IP:1446/rtc/fileshare/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' https://$NGCP_IP:1446/rtc/fileshare/uploadsResponse 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: