Sending a File by a Customer (uploadFileStream)
Scenario
After a connection is set up between a customer and an agent, the customer sends a file.
A file sent by a customer is uploaded to the file server of the AICC. The API invocation result contains the key value of the file in the file server.
The key value must be carried when the customer invokes the send or senAsync API to send messages.
Method
POST
URI
https://Domain name/apiaccess/ccmessaging/uploadFileStream (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 |
fileType |
String |
Yes |
File type. The supported types include JPG, PNG, BPM, MP3, AAC, MP4, TXT, and CSV. |
1.2 |
fileStream |
String |
Yes |
File stream encoded using Base64 |
1.3 |
channel |
String |
Yes |
Channel for sending file streams. Only WEB is supported. |
Response Description
- Status code: 200
Table 4 Response body parameters No.
Parameter
Type
Description
1.1
returnCode
String
Return code. The value 0 indicates success, and other values indicate failure. The error codes include:
- 2: missing parameter
- 3: incorrect parameter
- 13: upload failure
1.2
objectKey
String
Object key
- 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
{ "fileType": "jpg", "channel": "WEB", "fileStream": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIp3+7j8a/PP/gqXP5/7QXh9tu3/AIpi34z/ANPV3SpXfxCP/9k=" }
Response parameters:
{ "returnCode": "0", "objectKey": "44992392******************6cc328db296" }
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