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
Fields | Type | Explanations | Default Value | Value Examples |
---|---|---|---|---|
area_type | int | Data Cluster 1:Outside Mainland of China, 2:Mainland of China | -- | 1 |
file_name | string | file name | -- | test.txt |
file_md5 | string | file MD5 | -- | 1ceada6012b007afb4b0a29984660ad0 |
Response (area_type=1)
Fields | Type | Explanations |
---|---|---|
code | int | 200 code, is success. Others, are fail. |
msg | string | If success, return to “success”. If fail, return to detailed wrong info. |
data | json | If success, return to “success”. If fail, return to detailed wrong info. |
area_type | int | Data cluster 1: Non-mainland China area, 2: Mainland China area |
file_name | int | File name |
file_md5 | int | File MD5 |
ttl | int | Time-to-live (in seconds) |
method | json | Request method for uploading files to S3 |
url | string | Request URL for uploading files to S3 |
data_path | string | Full 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)
Fields | Type | Explanations |
---|---|---|
code | int | 200 code, is success. Others, are fail. |
msg | string | If success, return to “success”. If fail, return to detailed wrong info. |
data | json | If success, return to “success”. If fail, return to detailed wrong info. |
area_type | int | Data cluster 1: Non-mainland China area, 2: Mainland China area |
file_name | int | File name |
file_md5 | int | File MD5 |
ttl | int | Time-to-live (in seconds) |
oss | json | Pre-signed information for uploading files to OSS |
method | string | Request method for uploading files to OSS |
accessid | string | Access ID for uploading files to OSS |
host | string | Request address for uploading files to OSS |
expire | int | Signature expiration time for uploading files to OSS (timestamp) |
signature | string | Signature for uploading files to OSS |
policy | string | Policy for uploading files to OSS |
dir | string | Key for uploading files to OSS |
data_path | string | Full 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.