Skip to content

Upload Audience File

PS: You need to use Token. For more details, please checkToken

Initiate a pre-signed request to obtain pre-signed information for uploading files.
Based on the pre-signed information, upload the audience package file.

File requirements:
Supported formats include txt, csv, gz (where files inside gz are either txt or csv, i.e., .txt.gz or .csv.gz).
Maximum file size limit is 5GB.

Request address

https://ss-api.mintegral.com/api/open/v1/audience/presigned-upload-data

Request method

GET

Request example

json
GET /api/open/v1/audience/presigned-upload-data?area_type=1&file_name=test.txt&file_md5=1ceada6012b007afb4b0a29984660ad0 HTTP/1.1
Host: ss-api.mintegral.com

Request Parameter

FieldsTypeExplanationsDefault ValueValue Examples
area_typeintData Cluster
1:Outside Mainland of China, 2:Mainland of China
--1
file_namestringfile name--test.txt
file_md5stringfile MD5--1ceada6012b007afb4b0a29984660ad0

Response (area_type=1)

FieldsTypeExplanations
codeint200 code, is success. Others, are fail.
msgstringIf success, return to “success”. If fail, return to detailed wrong info.
datajsonIf success, return to “success”. If fail, return to detailed wrong info.
area_typeintData cluster
1: Non-mainland China area, 2: Mainland China area
file_nameintFile name
file_md5intFile MD5
ttlintTime-to-live (in seconds)
methodjsonRequest method for uploading files to S3
urlstringRequest URL for uploading files to S3
data_pathstringFull path for uploading files to S3, used for Creating Audience

Response Example (area_type=1)

json
{
    "code": 200,
    "message": "success",
    "data": {
        "area_type": 1,
        "file_name": "audience_file.txt",
        "file_md5": "1ceada6012b007afb4b0a29984660ad0",
        "ttl": 300,
        "s3": {
            "method": "{data.s3.method}",
            "url": "{data.s3.url}",
            "data_path": "{data.s3.path}"
        }
    }
}

Upload File Example (area_type=1)

json
curl -X {data.s3.method} -T "{path_to_file}" "{data.s3.url}"

For example:

The pre-signed information returned by the pre-signed request interface.
{data.s3.method} = PUT
{data.s3.url} = https://upload.s3.amazonaws.com?abc=123
{data.s3.path} = s3://s3/path/to/file

Your file path
{path_to_file} = /path/to/file

curl -X PUT -T "/path/to/file" "https://upload.s3.amazonaws.com?abc=123"

After successful upload, use {data.s3.data_path} for Creating Audience.

Response (area_type=2)

FieldsTypeExplanations
codeint200 code, is success. Others, are fail.
msgstringIf success, return to “success”. If fail, return to detailed wrong info.
datajsonIf success, return to “success”. If fail, return to detailed wrong info.
area_typeintData cluster
1: Non-mainland China area, 2: Mainland China area
file_nameintFile name
file_md5intFile MD5
ttlintTime-to-live (in seconds)
ossjsonPre-signed information for uploading files to OSS
methodstringRequest method for uploading files to OSS
accessidstringAccess ID for uploading files to OSS
hoststringRequest address for uploading files to OSS
expireintSignature expiration time for uploading files to OSS (timestamp)
signaturestringSignature for uploading files to OSS
policystringPolicy for uploading files to OSS
dirstringKey for uploading files to OSS
data_pathstringFull path for uploading files to OSS, used for Creating Audience

Response Example (area_type=2)

json
{
    "code": 200,
    "message": "success",
    "data": {
        "area_type": 2,
        "file_name": "test.txt",
        "file_md5": "1ceada6012b007afb4b0a29984660ad0",
        "ttl": 300,
        "oss": {
            "method": "{data.oss.method}",
            "accessid": "{data.oss.accessid}",
            "host": "{data.oss.host}",
            "expire": 1704892428,
            "signature": "{data.oss.signature}",
            "policy": "{data.oss.policy}",
            "dir": "{data.oss.dir}",
            "data_path": "{data.oss.data_path}"
        }
    }
}

Upload File Example (area_type=2)

json
curl --request {data.oss.method} '{data.oss.host}' \
--form 'key="{data.oss.dir}"' \
--form 'OSSAccessKeyId="{data.oss.accessid}"' \
--form 'policy="{data.oss.policy}"' \
--form 'signature="{data.oss.signature}"' \
--form 'success_action_status="200"' \
--form 'file=@"{path_to_file}"'

For example:

The pre-signed information returned by the pre-signed request interface.
{data.oss.method} = POST
{data.oss.host} = https://upload.cn.aliyuncs.com
{data.oss.dir} = dir/audience.txt
{data.oss.accessid} = accessid123
{data.oss.policy} = policy456
{data.oss.signature} = signature789

Your file path
{path_to_file} = /path/to/file

curl --request POST 'https://upload.cn.aliyuncs.com' \
--form 'key="dir/audience.txt"' \
--form 'OSSAccessKeyId="accessid123"' \
--form 'policy="policy456"' \
--form 'signature="signature789"' \
--form 'success_action_status="200"' \
--form 'file=@"/path/to/file"'

After successful upload, use {data.oss.data_path} for Creating Audience.