Updated on 2023-09-27 GMT+08:00

Sending a File by a Customer (uploadFileStream)

Scenario

This interface is invoked by a customer to send a file.

Method

POST

URI

https://Domain name/apiaccess/ccmessaging/uploadFileStream (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

ccmessaging-token

String

Yes

  • Value of token returned by the applyToken interface
  • Value of ccmessaging-token returned in the interface response header during a session

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.)

Table 2 Request body parameter

No.

Parameter

Type

Mandatory or Not

Description

1

reqBody

ReqBody

Yes

Request body

Table 3 ReqBody parameters

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

Request parameters:
{
	"fileType": "jpg",
	"channel": "WEB",
	"fileStream": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIp3+7j8a/PP/gqXP5/7QXh9tu3/AIpi34z/ANPV3SpXfxCP/9k="
}

Response parameters:

{
	"returnCode": "0",
	"objectKey": "44992392******************6cc328db296"
}