Receiving a File by a Customer (downloadFileStream)
Scenario
This interface is invoked by a customer to receive a file.
Method
POST
URI
https://Domain name/apiaccess/ccmessaging/downloadFileStream (For example, the domain name is service.besclouds.com.)
Request Description
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1 |
ccmessaging-token |
String |
Yes |
|
2 |
x-app-key |
String |
Yes |
App key, which is the user ID and is configured on the API Fabric |
3 |
Authorization |
String |
Yes |
Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.) |
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1 |
reqBody |
Yes |
Request body |
No. |
Parameter |
Type |
Mandatory or Not |
Description |
---|---|---|---|---|
1.1 |
fileId |
String |
Yes |
File ID for file download, which is carried in the poll interface If the value of fileId is local/{Value of content}, a local file is sent. The value of content is in the response of the poll interface. |
1.2 |
channel |
String |
Yes |
Download channel type. Currently, the value is fixed to WEB. |
1.3 |
fileType |
String |
Yes |
Type of the file to be downloaded. The options are jpg, png, bpm, mp3, aac, mp4, txt, csv, richtext, doc, docx, pdf, and zip. In scenarios where local files are sent, set this parameter to the value of mediaFileType in the MT multimedia file message. |
1.4 |
multiMedia |
String |
No |
If the file is a multimedia library file, this parameter is mandatory and must be set to multiMedia. |
Response Description
- Status code: 200
Table 4 RspBody parameter structure No.
Parameter
Type
Mandatory or Not
Description
1.1
fileStream
String
No
File stream encoded using Base64
1.2
resultCode
String
Yes
Return code. The value 0 indicates success, and other values indicate failure.
- If resultCode is 0, the operation is successful, and no description is returned.
- If resultCode is 401, the description is objectKey is null!
- If resultCode is 13, the description is param filetype Out of range!, empty file!, fsservice downloadFile is failed, downloadFileStream IOException, or downloadFileStream exception.
- If resultCode is 2, the description is param channelId or userId or tenantId is null.
1.3
resultDesc
String
No
Return description. The return code 0 indicates success, and other return codes indicate failure.
- Status code: 400
Incorrect request. Check the request path and parameters.
- Status code: 401
Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.
- Status code: 404
The requested content is not found. Check the request path.
- Status code: 500
Business failure. Check the values of parameters in the request.
Error Codes
None
Example
- Scenario:
{ "fileType": "jpg", "channel": "WEB", "fileId": "XXXXXXXXXXXXXXXX" "multiMedia":"multiMedia" }
Response parameters:
{ "fileStream": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAA9ADwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcI" }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot