← 返回 API 列表 ← 项目门户

新建全域投放项目

关键信息详情
文档 ID1854206019149016
标签 ID7
原始文档[https://open.oceanengine.com/labels/7/docs/1854206019149016](https://open.oceanengine.com/labels/7/docs/1854206019149016)
接口标识uni_project.create
💡用于创建全域投放项目,需提供客户ID、项目名称、营销产品等信息。适用场景为需要创建新的全域投放项目时使用。关键配合接口有【获取Access token】、【商品投放-查询商品库】、【商品投放-获取商品列表】等。 新建全域投放项目
POST https://api.oceanengine.com/open_api/v3.0/uni_project/create/ 🔍 可视化调试 📦 SDK下载

接口说明

用于创建全域投放项目,需提供客户ID、项目名称、营销产品等信息。适用场景为需要创建新的全域投放项目时使用。关键配合接口有【获取Access token】、【商品投放-查询商品库】、【商品投放-获取商品列表】等。

新建全域投放项目

请求地址

https://api.oceanengine.com/open_api/v3.0/uni_project/create/可视化调试SDK下载

请求方法

POST

Header

字段 类型 必填 描述
Access-Token string 必填 授权access_token,可以通过【获取Access token】接口获取
Content-Type string 必填 请求消息类型
允许值: application/json

请求参数

字段 类型 必填 描述
advertiser_id number 必填 客户id
name string 必填 项目名称,长度是1-50个字(两个英文字符占1个字)
delivery_product string 必填 营销产品,可选值:
- ALBUM 剧目
related_product(object,否) — 关联产品投放相关参数 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `product_platform_id` | number | 条件必填 | **当营销产品=剧目时,有效且必填**
商品库ID,可通过[【商品投放-查询商品库】](https://open.oceanengine.com/labels/7/docs/1696710577036288)查询。 | | `product_id` | number | 条件必填 | 商品id,可通过[【商品投放-获取商品列表】](https://open.oceanengine.com/labels/7/docs/1696710578078732)查询。
**当营销产品=剧目时,有效且必填**,**单次**请求最多支持传入**一个商品id** |
字段 类型 必填 描述
aweme_id string 条件必填 抖音号id,可通过【获取全域创编可用抖音号】接口获取
当投放载体=抖音号时,有效且必填,单次请求最多支持传入一个抖音号id
budget float 必填 项目预算,单位为元
填写限制:
取值范围[300,9999999.99],小数点后两位
uni_roi_goal float 必填 ROI系数
取值范围[0,5]
monetization_mode string 必填 投放变现模式,允许值:- IAP用户付费
- IAA_AND_IAP混合变现
schedule_type string 必填 - 投放时间类型,允许值:
- SCHEDULE_FROM_NOW从今天起长期投放
- SCHEDULE_START_END 设置开始和结束日期
start_time string 条件必填 投放起始时间,当schedule_type = SCHEDULE_START_END时必填
如:2017-01-01 精确到天。
end_time string 条件必填 投放结束时间,当schedule_type = SCHEDULE_START_END时必填
如:2017-01-01 精确到天
schedule_time string 否 投放时段,默认全时段投放,格式是48*7位字符串,且都是0或1。也就是以半个小时为最小粒度,周一至周日每天分为48个区段,0为不投放,1为投放,不传、全传0、全传1均代表全时段投放。
例如:000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000001111000000000000000000000,则投放时段为周一到周日的11:30~13:30
aigc_dynamic_creative_switch string 否 是否开启AIGC动态创意,系统将根据创意生态要求生成素材探索,不传表示开启,创建后支持修改。可选值:
ON 开启(默认值)
OFF 关闭
audience(object,否) — 定向设置 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `district` | string | 否 | 地域类型,允许值:- `BUSINESS_DISTRICT`商圈
- `REGION` 行政区域
- `NONE` 不限 |
geolocation(object[],否) — 从地图添加(地图位置),district为"BUSINESS_DISTRICT"时填写,最多允许添加1000个 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `name` | string | 否 | 地点名称 | | `long` | float | 否 | 经度 | | `lat` | float | 否 | 纬度 | | `radius` | number | 否 | 半径,单位为m,允许值为:3000~30000,默认值为6000 |
| 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `region_version` | string | 否 | - 当前仅允许传入`2.3.2`枚举,否则接口会报错
行政区域版本号,通过[【获取行政信息】](https://open.oceanengine.com/doc/index.html?key=ad&type=api&id=1709606596424718)接口获取district =`REGION`时必填 | | `city` | number[] | 条件必填 | 地域定向省市或者区县列表(当传递省份ID时,旗下市县ID可省略不传),当district=`REGION`/`OVERSEA`时必填,通过[【获取行政信息】](https://open.oceanengine.com/doc/index.html?key=ad&type=api&id=1709606596424718)接口获取 | | `location_type` | string | 条件必填 | 位置类型,允许值:- `CURRENT`正在该地区的用户
- `HOME`居住在该地区的用户
- `TRAVEL`到该地区旅行的用户
- `ALL`该地区内的所有用户
当city和district有值时,有效且必填 | | `gender` | string | 否 | 性别, 详见[【附录-受众性别】](https://ad.oceanengine.com/openapi/doc/index.html?id=1696710760171535#custom-anchor-受众性别),允许值:- `GENDER_FEMALE` 女
- `GENDER_MALE` 男
- `NONE` 不限(默认值) | | `age` | string[] | 否 | 两套枚举并存,但不支持同时传入
`AGE_BETWEEN_18_19`,`AGE_BETWEEN_20_23`,`AGE_BETWEEN_24_30`,`AGE_BETWEEN_31_35`,`AGE_BETWEEN_36_40`,`AGE_BETWEEN_41_45`,`AGE_BETWEEN_46_50`,`AGE_BETWEEN_51_55`,`AGE_BETWEEN_56_59`,`AGE_ABOVE_60`
年龄, 详见[【附录-受众年龄区间】](https://ad.oceanengine.com/openapi/doc/index.html?id=1696710760171535#custom-anchor-受众年龄区间)允许值:`AGE_BETWEEN_18_23`, `AGE_BETWEEN_24_30`,`AGE_BETWEEN_31_40`,`AGE_BETWEEN_41_49`, `AGE_ABOVE_50`或: | | `platform` | string[] | 否 | 允许值:`ANDROID`、`IOS` | | `hide_if_converted` | string | 否 | 过滤已转化用户,可以避免该单元再次投放给已转化过的用户。
允许值:- `NO_EXCLUDE` 不限制
- `PROJECT` 项目
- `ADVERTISER`投放账户
- `CUSTOMER`客户
- `ORGANIZATION` 组织 | | `converted_time_duration` | string | 否 | 当 hide_if_converted = `CUSTOMER` 公司帐户 或 `ORGANIZATION` 组织账户时传入有效,默认为`THREE_MONTH`
过滤时间范围,详见 [【附录-过滤时间范围】](https://ad.oceanengine.com/openapi/doc/index.html?id=1696710760171535#custom-anchor-过滤时间范围) | | `retargeting_tags_exclude` | number[] | 否 | 排除人群包列表(自定义人群),内容为人群包id。人群包id可通过【[人群包列表](https://open.oceanengine.com/labels/9/docs/1696710570721295)】获取 |
internal_advertiser_info(object,否) | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `classify` | string | 否 | 可选值:
- `CLASSIFY_APPORTION` 配量
- `CLASSIFY_EXCHANGE` 换量
- `CLASSIFY_INTERNAL` 内广
- `CLASSIFY_SALE` 售卖
- `CLASSIFY_SUPPLEMENT` 补量 | | `resource_entry_number` | string | 否 | | | `item_number` | string | 否 | | | `advertising_volume` | number | 否 | |
brand_info(object,条件必填) — 品牌信息,以下参数若有则生效必填,取值来源(更新):获取账户可投行业信息、获取账户可投品牌列表 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `yuntu_category_id` | number | 否 | 品牌分类id(取自接口【[获取账户可投行业信息](https://open.oceanengine.com/labels/7/docs/1866517384079625)】末级行业id,有则生效必填) | | `cdp_brand_id` | number | 否 | 归一化品牌id(原cdp品牌id,取自接口 【[获取账户可投品牌列表](https://open.oceanengine.com/labels/7/docs/1866516136873355)】merge_brand_id,有则生效必填) | | `ecom_brand_id` | number | 否 | 电商品牌id | | `brand_name_id` | number | 否 | 云图品牌id(取自接口【[获取账户可投品牌列表](https://open.oceanengine.com/labels/7/docs/1866516136873355)】yuntu_brand_detail.outer_brand_id,有则生效必填) | | `cdp_brand_name` | string | 否 | 归一化品牌名称(原cdp品牌名称,取自接口【[获取账户可投品牌列表](https://open.oceanengine.com/labels/7/docs/1866516136873355)】merge_brand_name,有则生效必填) | | `sub_brand_names` | string[] | 否 | 子品牌名称(取自接口【[获取账户可投品牌列表](https://open.oceanengine.com/labels/7/docs/1866516136873355)】sub_brand_details.brand_full_name,有则生效必填) | | `sub_brand_name_ids` | string[] | 否 | 子品牌id(取自接口【[获取账户可投品牌列表](https://open.oceanengine.com/labels/7/docs/1866516136873355)】sub_brand_details.outer_brand_id,有则生效必填) |
字段 类型 必填 描述
source string 必填 自定义抖音名称
video_material_list(object[],否) — 视频素材信息,单剧目在创建时最多设置视频素材 200 个<br>如需上传更多视频素材,可通过【批量添加项目下素材】接口追投 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `image_mode` | string | 条件必填 | 视频素材类型,允许值:
`CREATIVE_IMAGE_MODE_VIDEO_VERTICAL` 竖版视频
`CREATIVE_IMAGE_MODE_VIDEO` 横版视频 | | `video_id` | string | 条件必填 | 视频ID,可通过[【获取视频素材】](https://open.oceanengine.com/doc/index.html?key=ad&type=api&id=1696710601820172)或【获取账户可用的组织视频列表】获得 | | `video_cover_id` | string | 条件必填 | 视频封面图片ID,可通过[【获取图片素材】](https://open.oceanengine.com/labels/7/docs/1696710601254912)接口获得 | | `item_id` | number | 否 | 注:当aweme_id传入时有效
抖音短视频ID,通过[【获取抖音主页视频】](https://open.oceanengine.com/labels/7/docs/1729982871844879)或 [【获取抖音授权关系】](https://open.oceanengine.com/labels/7/docs/1729983667746823)获取主页视频或合作授权视频 | | `video_hp_visibility` | string | 否 | 视频素材主页可见性设置,该参数只针对非抖音视频生效可选值:- `ALWAYS_VISIBLE` 主页始终可见
- `HIDE_VIDEO_ON_HP` 仅单次展示可见(默认值) |
playlet_series_url_info(object[],否) — 短剧专辑链接信息,注意:IAA链接仅支持传入1个,IAP链接最多支持传入10个 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `playlet_series_url_type` | string | 条件必填 | 短剧专辑链接类型,允许值:- `IAA`,当delivery_product=ALBUM剧目,monetization_mode=IAA_AND_IAP 时,支持传入
- `IAP`,当delivery_product=ALBUM剧目,且monetization_mode=IAP 或 monetization_mode=IAA_AND_IAP 时,支持传入 | | `playlet_series_url` | string | 条件必填 | 短剧专辑链接- IAA链接,当playlet_series_url_type=`IAA`时,支持传入
- IAP链接,当playlet_series_url_type=`IAP`时,支持传入 |
title_material_list(object[],否) — 标题素材信息,单剧目最多设置标题素材100个 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `title` | string | 条件必填 | 创意标题 |
product_info(object,否) — 产品信息 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `titles` | string[] | 否 | 产品名称,字数限制:[1-20],数组上限为1- 本参数非必填,全域中所关联的产品会在此参数中,自动绑定一个与产品相关的title
- 用户可在默认绑定的titles外,额外填写1个产品名称 | | `image_ids` | string[] | 否 | 产品主图,尺寸要求108*108,上限10个
可通过【获取图片素材】接口获得- 全域中所关联的产品会在此参数中,绑定一个与产品相关主图,除了自动绑定的主图外,还需手动上传至少1个主图,上限为10个 | | `selling_points` | string[] | 否 | 产品卖点,字数限制:[6-9],数组上限为10 |
字段 类型 必填 描述
call_to_action_buttons string[] 否 行动号召文案,字数限制:[2-6],数组上限为10

请求示例

python

# coding=utf-8
import json
import requests

from six import string_types
from six.moves.urllib.parse import urlencode, urlunparse  # noqa

ACCESS_TOKEN = "xxx"
PATH = "/open_api/v3.0/uni_project/create/"


def build_url(path, query=""):
    # type: (str, str) -> str
    """
    Build request URL
    :param path: Request path
    :param query: Querystring
    :return: Request URL
    """
    scheme, netloc = "https", "api.oceanengine.com"
    return urlunparse((scheme, netloc, path, "", query, ""))

def post(json_str):
    # type: (str) -> dict
    """
    Send POST request
    :param json_str: Args in JSON format
    :return: Response in JSON format
    """
    url = build_url(PATH)
    args = json.loads(json_str)
    headers = {
        "Access-Token": ACCESS_TOKEN,
        "Content-Type": "application/json",
    }
    rsp = requests.post(url, headers=headers, json=args)
    return rsp.json()


if __name__ == '__main__':
    advertiser_id = ADVERTISER_ID
    name = NAME
    delivery_product = DELIVERY_PRODUCT
    product_platform_id = PRODUCT_PLATFORM_ID
    product_id = PRODUCT_ID
    delivery_medium = DELIVERY_MEDIUM
    aweme_id = AWEME_ID
    budget = BUDGET
    uni_roi_goal = UNI_ROI_GOAL
    monetization_mode = MONETIZATION_MODE
    schedule_type = SCHEDULE_TYPE
    start_time = START_TIME
    end_time = END_TIME
    schedule_time = SCHEDULE_TIME
    aigc_dynamic_creative_switch = AIGC_DYNAMIC_CREATIVE_SWITCH
    district = DISTRICT
    name = NAME
    long = LONG
    lat = LAT
    radius = RADIUS
    region_version = REGION_VERSION
    city_list = CITY
    city = json.dumps(city_list)
    location_type = LOCATION_TYPE
    gender = GENDER
    age_list = AGE
    age = json.dumps(age_list)
    platform_list = PLATFORM
    platform = json.dumps(platform_list)
    hide_if_converted = HIDE_IF_CONVERTED
    converted_time_duration = CONVERTED_TIME_DURATION
    retargeting_tags_include_list = RETARGETING_TAGS_INCLUDE
    retargeting_tags_include = json.dumps(retargeting_tags_include_list)
    retargeting_tags_exclude_list = RETARGETING_TAGS_EXCLUDE
    retargeting_tags_exclude = json.dumps(retargeting_tags_exclude_list)
    yuntu_category_id = YUNTU_CATEGORY_ID
    cdp_brand_id = CDP_BRAND_ID
    ecom_brand_id = ECOM_BRAND_ID
    brand_name_id = BRAND_NAME_ID
    cdp_brand_name = CDP_BRAND_NAME
    sub_brand_names_list = SUB_BRAND_NAMES
    sub_brand_names = json.dumps(sub_brand_names_list)
    sub_brand_name_ids_list = SUB_BRAND_NAME_IDS
    sub_brand_name_ids = json.dumps(sub_brand_name_ids_list)
    image_mode = IMAGE_MODE
    video_id = VIDEO_ID
    video_cover_id = VIDEO_COVER_ID
    item_id = ITEM_ID
    video_hp_visibility = VIDEO_HP_VISIBILITY
    playlet_series_url_type = PLAYLET_SERIES_URL_TYPE
    playlet_series_url = PLAYLET_SERIES_URL
    title = TITLE
    titles_list = TITLES
    titles = json.dumps(titles_list)
    image_ids_list = IMAGE_IDS
    image_ids = json.dumps(image_ids_list)
    selling_points_list = SELLING_POINTS
    selling_points = json.dumps(selling_points_list)
    call_to_action_buttons_list = CALL_TO_ACTION_BUTTONS
    call_to_action_buttons = json.dumps(call_to_action_buttons_list)

    # Args in JSON format
    my_args = "{\"advertiser_id\": \"%s\", \"name\": \"%s\", \"delivery_product\": \"%s\", \"related_product\": {\"product_platform_id\": \"%s\", \"product_id\": \"%s\"}, \"delivery_medium\": \"%s\", \"aweme_id\": \"%s\", \"budget\": \"%s\", \"uni_roi_goal\": \"%s\", \"monetization_mode\": \"%s\", \"schedule_type\": \"%s\", \"start_time\": \"%s\", \"end_time\": \"%s\", \"schedule_time\": \"%s\", \"aigc_dynamic_creative_switch\": \"%s\", \"audience\": {\"district\": \"%s\", \"geolocation\": [{\"name\": \"%s\", \"long\": \"%s\", \"lat\": \"%s\", \"radius\": \"%s\"}], \"region_version\": \"%s\", \"city\": %s, \"location_type\": \"%s\", \"gender\": \"%s\", \"age\": %s, \"platform\": %s, \"hide_if_converted\": \"%s\", \"converted_time_duration\": \"%s\", \"retargeting_tags_include\": %s, \"retargeting_tags_exclude\": %s}, \"brand_info\": {\"yuntu_category_id\": \"%s\", \"cdp_brand_id\": \"%s\", \"ecom_brand_id\": \"%s\", \"brand_name_id\": \"%s\", \"cdp_brand_name\": \"%s\", \"sub_brand_names\": %s, \"sub_brand_name_ids\": %s}, \"video_material_list\": [{\"image_mode\": \"%s\", \"video_id\": \"%s\", \"video_cover_id\": \"%s\", \"item_id\": \"%s\", \"video_hp_visibility\": \"%s\"}], \"playlet_series_url_info\": [{\"playlet_series_url_type\": \"%s\", \"playlet_series_url\": \"%s\"}], \"title_material_list\": [{\"title\": \"%s\"}], \"product_info\": {\"titles\": %s, \"image_ids\": %s, \"selling_points\": %s}, \"call_to_action_buttons\": %s}" % (advertiser_id, name, delivery_product, product_platform_id, product_id, delivery_medium, aweme_id, budget, uni_roi_goal, monetization_mode, schedule_type, start_time, end_time, schedule_time, aigc_dynamic_creative_switch, district, name, long, lat, radius, region_version, city, location_type, gender, age, platform, hide_if_converted, converted_time_duration, retargeting_tags_include, retargeting_tags_exclude, yuntu_category_id, cdp_brand_id, ecom_brand_id, brand_name_id, cdp_brand_name, sub_brand_names, sub_brand_name_ids, image_mode, video_id, video_cover_id, item_id, video_hp_visibility, playlet_series_url_type, playlet_series_url, title, titles, image_ids, selling_points, call_to_action_buttons)
    print(post(my_args))

java

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import okhttp3.*;
import org.apache.http.client.utils.URIBuilder;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Demo {
    private static final String ACCESS_TOKEN = "xxx";
    private static final String PATH = "/open_api/v3.0/uni_project/create/";
    private static final ObjectMapper mapper = new ObjectMapper();

    /**
     * Build request URL
     *
     * @param path Request path
     * @return Request URL
     */
    private static String buildUrl(String path) throws URISyntaxException {
        URI uri = new URI("https", "api.oceanengine.com", path, "", "");
        return uri.toString();
    }


    /**
     * Send POST request
     *
     * @param jsonStr Args in JSON format
     * @return Response in JSON format
     */
    private static String post(String jsonStr) throws IOException, URISyntaxException {
        OkHttpClient client = new OkHttpClient().newBuilder().build();
        String url = buildUrl(PATH);

        RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonStr);
        Request request = new Request.Builder()
                .url(url)
                .method("POST", body)
                .addHeader("Content-Type", "application/json")
                .addHeader("Access-Token", ACCESS_TOKEN)
                .build();
        Response response = client.newCall(request).execute();
        return response.body().string();
    }


    public static void main(String[] args) throws IOException, URISyntaxException {
        Long advertiser_id = ADVERTISER_ID;
        String name = NAME;
        String delivery_product = DELIVERY_PRODUCT;
        Long product_platform_id = PRODUCT_PLATFORM_ID;
        String product_id = PRODUCT_ID;
        String delivery_medium = DELIVERY_MEDIUM;
        String aweme_id = AWEME_ID;
        Double budget = BUDGET;
        Double uni_roi_goal = UNI_ROI_GOAL;
        String monetization_mode = MONETIZATION_MODE;
        String schedule_type = SCHEDULE_TYPE;
        String start_time = START_TIME;
        String end_time = END_TIME;
        String schedule_time = SCHEDULE_TIME;
        String aigc_dynamic_creative_switch = AIGC_DYNAMIC_CREATIVE_SWITCH;
        String district = DISTRICT;
        String name = NAME;
        Double long = LONG;
        Double lat = LAT;
        Long radius = RADIUS;
        String region_version = REGION_VERSION;
        List < Long > city_list = CITY;
        String city = mapper.writeValueAsString(city_list);
        String location_type = LOCATION_TYPE;
        String gender = GENDER;
        List < String > age_list = AGE;
        String age = mapper.writeValueAsString(age_list);
        List < String > platform_list = PLATFORM;
        String platform = mapper.writeValueAsString(platform_list);
        String hide_if_converted = HIDE_IF_CONVERTED;
        String converted_time_duration = CONVERTED_TIME_DURATION;
        List < Long > retargeting_tags_include_list = RETARGETING_TAGS_INCLUDE;
        String retargeting_tags_include = mapper.writeValueAsString(retargeting_tags_include_list);
        List < Long > retargeting_tags_exclude_list = RETARGETING_TAGS_EXCLUDE;
        String retargeting_tags_exclude = mapper.writeValueAsString(retargeting_tags_exclude_list);
        Long yuntu_category_id = YUNTU_CATEGORY_ID;
        Long cdp_brand_id = CDP_BRAND_ID;
        Long ecom_brand_id = ECOM_BRAND_ID;
        Long brand_name_id = BRAND_NAME_ID;
        String cdp_brand_name = CDP_BRAND_NAME;
        List < String > sub_brand_names_list = SUB_BRAND_NAMES;
        String sub_brand_names = mapper.writeValueAsString(sub_brand_names_list);
        List < String > sub_brand_name_ids_list = SUB_BRAND_NAME_IDS;
        String sub_brand_name_ids = mapper.writeValueAsString(sub_brand_name_ids_list);
        String image_mode = IMAGE_MODE;
        String video_id = VIDEO_ID;
        String video_cover_id = VIDEO_COVER_ID;
        Long item_id = ITEM_ID;
        String video_hp_visibility = VIDEO_HP_VISIBILITY;
        String playlet_series_url_type = PLAYLET_SERIES_URL_TYPE;
        String playlet_series_url = PLAYLET_SERIES_URL;
        String title = TITLE;
        List < String > titles_list = TITLES;
        String titles = mapper.writeValueAsString(titles_list);
        List < String > image_ids_list = IMAGE_IDS;
        String image_ids = mapper.writeValueAsString(image_ids_list);
        List < String > selling_points_list = SELLING_POINTS;
        String selling_points = mapper.writeValueAsString(selling_points_list);
        List < String > call_to_action_buttons_list = CALL_TO_ACTION_BUTTONS;
        String call_to_action_buttons = mapper.writeValueAsString(call_to_action_buttons_list);

        // Args in JSON format
        String myArgs = String.format("{\"advertiser_id\": \"%s\", \"name\": \"%s\", \"delivery_product\": \"%s\", \"related_product\": {\"product_platform_id\": \"%s\", \"product_id\": \"%s\"}, \"delivery_medium\": \"%s\", \"aweme_id\": \"%s\", \"budget\": \"%s\", \"uni_roi_goal\": \"%s\", \"monetization_mode\": \"%s\", \"schedule_type\": \"%s\", \"start_time\": \"%s\", \"end_time\": \"%s\", \"schedule_time\": \"%s\", \"aigc_dynamic_creative_switch\": \"%s\", \"audience\": {\"district\": \"%s\", \"geolocation\": [{\"name\": \"%s\", \"long\": \"%s\", \"lat\": \"%s\", \"radius\": \"%s\"}], \"region_version\": \"%s\", \"city\": %s, \"location_type\": \"%s\", \"gender\": \"%s\", \"age\": %s, \"platform\": %s, \"hide_if_converted\": \"%s\", \"converted_time_duration\": \"%s\", \"retargeting_tags_include\": %s, \"retargeting_tags_exclude\": %s}, \"brand_info\": {\"yuntu_category_id\": \"%s\", \"cdp_brand_id\": \"%s\", \"ecom_brand_id\": \"%s\", \"brand_name_id\": \"%s\", \"cdp_brand_name\": \"%s\", \"sub_brand_names\": %s, \"sub_brand_name_ids\": %s}, \"video_material_list\": [{\"image_mode\": \"%s\", \"video_id\": \"%s\", \"video_cover_id\": \"%s\", \"item_id\": \"%s\", \"video_hp_visibility\": \"%s\"}], \"playlet_series_url_info\": [{\"playlet_series_url_type\": \"%s\", \"playlet_series_url\": \"%s\"}], \"title_material_list\": [{\"title\": \"%s\"}], \"product_info\": {\"titles\": %s, \"image_ids\": %s, \"selling_points\": %s}, \"call_to_action_buttons\": %s}",advertiser_id, name, delivery_product, product_platform_id, product_id, delivery_medium, aweme_id, budget, uni_roi_goal, monetization_mode, schedule_type, start_time, end_time, schedule_time, aigc_dynamic_creative_switch, district, name, long, lat, radius, region_version, city, location_type, gender, age, platform, hide_if_converted, converted_time_duration, retargeting_tags_include, retargeting_tags_exclude, yuntu_category_id, cdp_brand_id, ecom_brand_id, brand_name_id, cdp_brand_name, sub_brand_names, sub_brand_name_ids, image_mode, video_id, video_cover_id, item_id, video_hp_visibility, playlet_series_url_type, playlet_series_url, title, titles, image_ids, selling_points, call_to_action_buttons);
        System.out.println(post(myArgs));
    }
}

php


$ACCESS_TOKEN = "xxx";
$PATH = "/open_api/v3.0/uni_project/create/";

/**
 * Build request URL
 * @param $path : Request path
 * @return string
 */
function build_url($path)
{
    return "https://api.oceanengine.com" . $path;
}


/**
 * Send POST request
 * @param $json_str : Args in JSON format
 * @return bool|string : Response in JSON format
 */
function post($json_str)
{
    global $ACCESS_TOKEN, $PATH;
    $curl = curl_init();

    $url = build_url($PATH);

    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => $json_str,
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json",
            "Access-Token: " . $ACCESS_TOKEN,
        ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);
    return $response;
}


$advertiser_id = ADVERTISER_ID;
$name = NAME;
$delivery_product = DELIVERY_PRODUCT;
$product_platform_id = PRODUCT_PLATFORM_ID;
$product_id = PRODUCT_ID;
$delivery_medium = DELIVERY_MEDIUM;
$aweme_id = AWEME_ID;
$budget = BUDGET;
$uni_roi_goal = UNI_ROI_GOAL;
$monetization_mode = MONETIZATION_MODE;
$schedule_type = SCHEDULE_TYPE;
$start_time = START_TIME;
$end_time = END_TIME;
$schedule_time = SCHEDULE_TIME;
$aigc_dynamic_creative_switch = AIGC_DYNAMIC_CREATIVE_SWITCH;
$district = DISTRICT;
$name = NAME;
$long = LONG;
$lat = LAT;
$radius = RADIUS;
$region_version = REGION_VERSION;
$city_list = CITY;
$city = json_encode($city_list);
$location_type = LOCATION_TYPE;
$gender = GENDER;
$age_list = AGE;
$age = json_encode($age_list);
$platform_list = PLATFORM;
$platform = json_encode($platform_list);
$hide_if_converted = HIDE_IF_CONVERTED;
$converted_time_duration = CONVERTED_TIME_DURATION;
$retargeting_tags_include_list = RETARGETING_TAGS_INCLUDE;
$retargeting_tags_include = json_encode($retargeting_tags_include_list);
$retargeting_tags_exclude_list = RETARGETING_TAGS_EXCLUDE;
$retargeting_tags_exclude = json_encode($retargeting_tags_exclude_list);
$yuntu_category_id = YUNTU_CATEGORY_ID;
$cdp_brand_id = CDP_BRAND_ID;
$ecom_brand_id = ECOM_BRAND_ID;
$brand_name_id = BRAND_NAME_ID;
$cdp_brand_name = CDP_BRAND_NAME;
$sub_brand_names_list = SUB_BRAND_NAMES;
$sub_brand_names = json_encode($sub_brand_names_list);
$sub_brand_name_ids_list = SUB_BRAND_NAME_IDS;
$sub_brand_name_ids = json_encode($sub_brand_name_ids_list);
$image_mode = IMAGE_MODE;
$video_id = VIDEO_ID;
$video_cover_id = VIDEO_COVER_ID;
$item_id = ITEM_ID;
$video_hp_visibility = VIDEO_HP_VISIBILITY;
$playlet_series_url_type = PLAYLET_SERIES_URL_TYPE;
$playlet_series_url = PLAYLET_SERIES_URL;
$title = TITLE;
$titles_list = TITLES;
$titles = json_encode($titles_list);
$image_ids_list = IMAGE_IDS;
$image_ids = json_encode($image_ids_list);
$selling_points_list = SELLING_POINTS;
$selling_points = json_encode($selling_points_list);
$call_to_action_buttons_list = CALL_TO_ACTION_BUTTONS;
$call_to_action_buttons = json_encode($call_to_action_buttons_list);

/* Args in JSON format */
$my_args = sprintf("{\"advertiser_id\": \"%s\", \"name\": \"%s\", \"delivery_product\": \"%s\", \"related_product\": {\"product_platform_id\": \"%s\", \"product_id\": \"%s\"}, \"delivery_medium\": \"%s\", \"aweme_id\": \"%s\", \"budget\": \"%s\", \"uni_roi_goal\": \"%s\", \"monetization_mode\": \"%s\", \"schedule_type\": \"%s\", \"start_time\": \"%s\", \"end_time\": \"%s\", \"schedule_time\": \"%s\", \"aigc_dynamic_creative_switch\": \"%s\", \"audience\": {\"district\": \"%s\", \"geolocation\": [{\"name\": \"%s\", \"long\": \"%s\", \"lat\": \"%s\", \"radius\": \"%s\"}], \"region_version\": \"%s\", \"city\": %s, \"location_type\": \"%s\", \"gender\": \"%s\", \"age\": %s, \"platform\": %s, \"hide_if_converted\": \"%s\", \"converted_time_duration\": \"%s\", \"retargeting_tags_include\": %s, \"retargeting_tags_exclude\": %s}, \"brand_info\": {\"yuntu_category_id\": \"%s\", \"cdp_brand_id\": \"%s\", \"ecom_brand_id\": \"%s\", \"brand_name_id\": \"%s\", \"cdp_brand_name\": \"%s\", \"sub_brand_names\": %s, \"sub_brand_name_ids\": %s}, \"video_material_list\": [{\"image_mode\": \"%s\", \"video_id\": \"%s\", \"video_cover_id\": \"%s\", \"item_id\": \"%s\", \"video_hp_visibility\": \"%s\"}], \"playlet_series_url_info\": [{\"playlet_series_url_type\": \"%s\", \"playlet_series_url\": \"%s\"}], \"title_material_list\": [{\"title\": \"%s\"}], \"product_info\": {\"titles\": %s, \"image_ids\": %s, \"selling_points\": %s}, \"call_to_action_buttons\": %s}", $advertiser_id, $name, $delivery_product, $product_platform_id, $product_id, $delivery_medium, $aweme_id, $budget, $uni_roi_goal, $monetization_mode, $schedule_type, $start_time, $end_time, $schedule_time, $aigc_dynamic_creative_switch, $district, $name, $long, $lat, $radius, $region_version, $city, $location_type, $gender, $age, $platform, $hide_if_converted, $converted_time_duration, $retargeting_tags_include, $retargeting_tags_exclude, $yuntu_category_id, $cdp_brand_id, $ecom_brand_id, $brand_name_id, $cdp_brand_name, $sub_brand_names, $sub_brand_name_ids, $image_mode, $video_id, $video_cover_id, $item_id, $video_hp_visibility, $playlet_series_url_type, $playlet_series_url, $title, $titles, $image_ids, $selling_points, $call_to_action_buttons);
echo post($my_args);

curl

curl -H "Access-Token:xxx" -H "Content-Type:application/json" -X POST \
-d '{
    "advertiser_id": "ADVERTISER_ID",
    "name": "NAME",
    "delivery_product": "DELIVERY_PRODUCT",
    "related_product": {
        "product_platform_id": "PRODUCT_PLATFORM_ID",
        "product_id": "PRODUCT_ID"
    },
    "delivery_medium": "DELIVERY_MEDIUM",
    "aweme_id": "AWEME_ID",
    "budget": "BUDGET",
    "uni_roi_goal": "UNI_ROI_GOAL",
    "monetization_mode": "MONETIZATION_MODE",
    "schedule_type": "SCHEDULE_TYPE",
    "start_time": "START_TIME",
    "end_time": "END_TIME",
    "schedule_time": "SCHEDULE_TIME",
    "aigc_dynamic_creative_switch": "AIGC_DYNAMIC_CREATIVE_SWITCH",
    "audience": {
        "district": "DISTRICT",
        "geolocation": [
            {
                "name": "NAME",
                "long": "LONG",
                "lat": "LAT",
                "radius": "RADIUS"
            }
        ],
        "region_version": "REGION_VERSION",
        "city": [
            "CITY"
        ],
        "location_type": "LOCATION_TYPE",
        "gender": "GENDER",
        "age": [
            "AGE"
        ],
        "platform": [
            "PLATFORM"
        ],
        "hide_if_converted": "HIDE_IF_CONVERTED",
        "converted_time_duration": "CONVERTED_TIME_DURATION",
        "retargeting_tags_include": [
            "RETARGETING_TAGS_INCLUDE"
        ],
        "retargeting_tags_exclude": [
            "RETARGETING_TAGS_EXCLUDE"
        ]
    },
    "brand_info": {
        "yuntu_category_id": "YUNTU_CATEGORY_ID",
        "cdp_brand_id": "CDP_BRAND_ID",
        "ecom_brand_id": "ECOM_BRAND_ID",
        "brand_name_id": "BRAND_NAME_ID",
        "cdp_brand_name": "CDP_BRAND_NAME",
        "sub_brand_names": [
            "SUB_BRAND_NAMES"
        ],
        "sub_brand_name_ids": [
            "SUB_BRAND_NAME_IDS"
        ]
    },
    "video_material_list": [
        {
            "image_mode": "IMAGE_MODE",
            "video_id": "VIDEO_ID",
            "video_cover_id": "VIDEO_COVER_ID",
            "item_id": "ITEM_ID",
            "video_hp_visibility": "VIDEO_HP_VISIBILITY"
        }
    ],
    "playlet_series_url_info": [
        {
            "playlet_series_url_type": "PLAYLET_SERIES_URL_TYPE",
            "playlet_series_url": "PLAYLET_SERIES_URL"
        }
    ],
    "title_material_list": [
        {
            "title": "TITLE"
        }
    ],
    "product_info": {
        "titles": [
            "TITLES"
        ],
        "image_ids": [
            "IMAGE_IDS"
        ],
        "selling_points": [
            "SELLING_POINTS"
        ]
    },
    "call_to_action_buttons": [
        "CALL_TO_ACTION_BUTTONS"
    ]
}' \
https://api.oceanengine.com/open_api/v3.0/uni_project/create/

应答字段

字段 类型 必填 描述
code number 否 返回码,详见 【附录-返回码】
message string 否 返回信息,详见【附录-返回码】
data(json,否) — json返回值 | 字段 | 类型 | 必填 | 描述 | | --- | --- | --- | --- | | `project_id` | number | 否 | 项目id |
字段 类型 必填 描述
request_id string 否 请求日志id

应答示例

HTTPS/1.1 200 OK
{
    "message": "OK",
    "code": 0,
    "data": {}
}

业务错误码

仅披露当前接口高频的参数校验报错,更多常见报错详见「返回码」文档

在接这个接口时卡住了?
Stuck wiring this API into production? We build ad-delivery tooling on these platforms — campaign automation, reporting pipelines, error-handling and migration between API versions.
联系我们 · Talk to us 每日平台更新简报 →