---
title: "创建营销事件"
description: "创建marketingEvent"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/marketing/marketing-events/create-marketing-events'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-rest-api/marketing/marketing-events/create-marketing-events.md'
---
# 创建营销事件

创建marketingEvent

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_marketing_event`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /sales/marketing_events.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。

## Required Permissions

* `write_marketing_event`

## Request

### Request Headers

* `Content-Type`

  string (required)

  字段值固定为 `application/json; charset=utf-8`。

* `Authorization`

  string (required)

  资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。

### Request Body

* `marketing_event`

  object

  营销事件

  * `description`

    string

    描述

  * `utm_campaign`

    string

    标识具体的广告

  * `utm_term`

    string

    标识搜索的关键字

  * `marketing_channel`

    string

    营销事件选择的渠道● search ● display ● social ● email ● referral ● sms

  * `preview_url`

    string

    预览页的url（示例url仅提供参考）

  * `referring_domain`

    string

    营销事件的目的域名,如果marketing_channel是search和social的时候，需要指定

  * `utm_medium`

    string

    标识来源类型

  * `utm_source`

    string

    广告客户、广告网站

  * `event_type`

    string

    ● ad：广告 ● post：推送（FB贴文） ● message：短信 ● retargeting：动态重定向广告 ● transactional： ● affiliate：分销/KOL/红人 ● loyalty：礼品卡 ● newsletter：订阅邮件 ● abandoned_cart：弃单 ● live：直播

  * `manage_url`

    string

    管理页的url（示例仅提供参考）

  * `started_at`

    string

    开始时间

  * `utm_content`

    string

    区分同一个广告不同的链接

  * `ended_at`

    string

    结束时间

  * `remote_id`

    string

    资源id

## Response

### Status Codes

* `200`

  更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。

* `400`

  

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。

### Response Body

#### 200

* `marketing_event`

  object

  营销事件

  * `event_type`

    string

    ● ad：广告 ● post：推送（FB贴文） ● message：短信 ● retargeting：动态重定向广告 ● transactional： ● affiliate：分销/KOL/红人 ● loyalty：礼品卡 ● newsletter：订阅邮件 ● abandoned_cart：弃单 ● live：直播

  * `description`

    string

    营销活动描述

  * `id`

    string

    营销事件的id

  * `started_at`

    string

    开始时间

  * `marketing_channel`

    string

    营销事件选择的渠道● search ● display ● social ● email ● referral ● sms

  * `ended_at`

    string

    结束时间

  * `utm_content`

    string

    区分同一个广告不同的链接

  * `utm_term`

    string

    标识搜索的关键字

  * `marketing_event_id`

    string

    营销事件的唯一id

  * `manage_url`

    string

    管理页的url（示例url仅提供参考）

  * `referring_domain`

    string

    营销事件的目的域名,如果marketing_channel是search和social的时候，需要指定

  * `utm_source`

    string

    广告客户、广告网站

  * `utm_campaign`

    string

    标识具体的广告

  * `preview_url`

    string

    预览页的url（示例url仅提供参考）

  * `remote_id`

    string

    资源id

  * `utm_medium`

    string

    标识来源类型


#### 400

* `errors`

  string

  错误描述。


#### 401

* `errors`

  string

  错误描述。


#### 429

* `errors`

  string

  错误描述。


## OpenAPI Definition

```json
{
  "description": "创建marketingEvent",
  "externalDocs": {
    "description": "接口使用的权限点: `write_marketing_event` ，更多权限点使用信息，请参考:",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=zh-hans-cn",
    "errorTableDescription": ""
  },
  "operationId": "weHj9xMI",
  "parameters": [
    {
      "name": "Content-Type",
      "in": "header",
      "description": "字段值固定为 `application/json; charset=utf-8`。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": "资源的访问令牌。参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入。",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": "资源的访问令牌。请参考 [应用授权](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/app-authorization.md?lang=zh-hans-cn) 获取访问令牌，然后将获取到的访问令牌以 Bearer 格式传入",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "marketing_event": {
              "name": "marketing_event",
              "description": "营销事件",
              "type": "object",
              "properties": {
                "description": {
                  "name": "description",
                  "description": "描述",
                  "type": "string",
                  "example": "This is description for marketing event"
                },
                "utm_campaign": {
                  "name": "utm_campaign",
                  "description": "标识具体的广告",
                  "type": "string",
                  "example": "google"
                },
                "utm_term": {
                  "name": "utm_term",
                  "description": "标识搜索的关键字",
                  "type": "string",
                  "example": "This is search word for utm item"
                },
                "marketing_channel": {
                  "name": "marketing_channel",
                  "description": "营销事件选择的渠道● search ● display ● social ● email ● referral ● sms",
                  "type": "string",
                  "example": "search"
                },
                "preview_url": {
                  "name": "preview_url",
                  "description": "预览页的url（示例url仅提供参考）",
                  "type": "string",
                  "example": "https://manong.myshopline.com/"
                },
                "referring_domain": {
                  "name": "referring_domain",
                  "description": "营销事件的目的域名,如果marketing_channel是search和social的时候，需要指定",
                  "type": "string",
                  "example": "manong.myshopline.com"
                },
                "utm_medium": {
                  "name": "utm_medium",
                  "description": "标识来源类型",
                  "type": "string",
                  "example": "email"
                },
                "utm_source": {
                  "name": "utm_source",
                  "description": "广告客户、广告网站",
                  "type": "string",
                  "example": "manong.myshopline.com"
                },
                "event_type": {
                  "name": "event_type",
                  "description": "● ad：广告 ● post：推送（FB贴文） ● message：短信 ● retargeting：动态重定向广告 ● transactional： ● affiliate：分销/KOL/红人 ● loyalty：礼品卡 ● newsletter：订阅邮件 ● abandoned_cart：弃单 ● live：直播",
                  "type": "string",
                  "example": "ad"
                },
                "manage_url": {
                  "name": "manage_url",
                  "description": "管理页的url（示例仅提供参考）",
                  "type": "string",
                  "example": "https://manong.myshopline.com/admin/"
                },
                "started_at": {
                  "name": "started_at",
                  "description": "开始时间",
                  "type": "string",
                  "example": "2022-12-15T09:00:00+08:00"
                },
                "utm_content": {
                  "name": "utm_content",
                  "description": "区分同一个广告不同的链接",
                  "type": "string",
                  "example": "googleAds"
                },
                "ended_at": {
                  "name": "ended_at",
                  "description": "结束时间",
                  "type": "string",
                  "example": "2023-12-15T09:00:00+08:00"
                },
                "remote_id": {
                  "name": "remote_id",
                  "description": "资源id",
                  "type": "string",
                  "example": "6019932248291157288"
                }
              },
              "required": [
                "event_type",
                "marketing_channel"
              ],
              "example": {
                "utm_campaign": "google",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "started_at": "2022-12-15T09:00:00+08:00",
                "event_type": "ad",
                "remote_id": "6019932248291157288",
                "marketing_channel": "search",
                "referring_domain": "manong.myshopline.com",
                "utm_term": "This is search word for utm item",
                "description": "This is description for marketing event",
                "manage_url": "https://manong.myshopline.com/admin/",
                "preview_url": "https://manong.myshopline.com/",
                "utm_content": "googleAds",
                "utm_medium": "email",
                "utm_source": "manong.myshopline.com"
              }
            }
          },
          "example": {
            "marketing_event": {
              "utm_term": "This is search word for utm item",
              "remote_id": "6019932248291157288",
              "started_at": "2022-12-15T09:00:00+08:00",
              "utm_campaign": "google",
              "description": "This is description for marketing event",
              "marketing_channel": "search",
              "preview_url": "https://manong.myshopline.com/",
              "utm_content": "googleAds",
              "utm_source": "manong.myshopline.com",
              "ended_at": "2023-12-15T09:00:00+08:00",
              "manage_url": "https://manong.myshopline.com/admin/",
              "utm_medium": "email",
              "event_type": "ad",
              "referring_domain": "manong.myshopline.com"
            }
          }
        },
        "examples": {
          "创建一个营销事件": {
            "value": {
              "marketing_event": {
                "utm_medium": "email",
                "utm_term": "This is search word for utm item",
                "description": "This is description for marketing event",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "referring_domain": "manong.myshopline.com",
                "event_type": "ad",
                "utm_content": "googleAds",
                "utm_source": "manong.myshopline.com",
                "manage_url": "https://manong.myshopline.com/admin/",
                "preview_url": "https://manong.myshopline.com/",
                "remote_id": "6019932248291157288",
                "started_at": "2022-12-15T09:00:00+08:00",
                "marketing_channel": "search",
                "utm_campaign": "google"
              }
            }
          },
          "创建一个非法event type的营销事件": {
            "value": {
              "marketing_event": {
                "utm_content": "googleAds",
                "utm_source": "manong.myshopline.com",
                "referring_domain": "manong.myshopline.com",
                "utm_medium": "email",
                "utm_term": "This is search word for utm item",
                "preview_url": "https://manong.myshopline.com/",
                "started_at": "2022-12-15T09:00:00+08:00",
                "event_type": "illegal event type",
                "utm_campaign": "google",
                "marketing_channel": "search",
                "description": "This is description for marketing event",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "manage_url": "https://manong.myshopline.com/admin/",
                "remote_id": "6019932248291157288"
              }
            }
          },
          "创建一个非法marketing channel的营销事件": {
            "value": {
              "marketing_event": {
                "description": "This is description for marketing event",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "preview_url": "https://manong.myshopline.com/",
                "referring_domain": "manong.myshopline.com",
                "started_at": "2022-12-15T09:00:00+08:00",
                "manage_url": "https://manong.myshopline.com/admin/",
                "utm_content": "googleAds",
                "event_type": "ad",
                "marketing_channel": "illegal marketing channel",
                "utm_medium": "email",
                "utm_source": "manong.myshopline.com",
                "remote_id": "6019932248291157288",
                "utm_campaign": "google",
                "utm_term": "This is search word for utm item"
              }
            }
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "更多状态码信息，参考 [HTTP 状态码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/http-status-code.md?lang=zh-hans-cn)。",
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "marketing_event": {
                "name": "marketing_event",
                "description": "营销事件",
                "type": "object",
                "properties": {
                  "event_type": {
                    "name": "event_type",
                    "description": "● ad：广告 ● post：推送（FB贴文） ● message：短信 ● retargeting：动态重定向广告 ● transactional： ● affiliate：分销/KOL/红人 ● loyalty：礼品卡 ● newsletter：订阅邮件 ● abandoned_cart：弃单 ● live：直播",
                    "type": "string",
                    "example": "ad"
                  },
                  "description": {
                    "name": "description",
                    "description": "营销活动描述",
                    "type": "string",
                    "example": "This is description for marketing event"
                  },
                  "id": {
                    "name": "id",
                    "description": "营销事件的id",
                    "type": "string",
                    "example": "4073"
                  },
                  "started_at": {
                    "name": "started_at",
                    "description": "开始时间",
                    "type": "string",
                    "example": "2022-12-15T09:00:00+08:00"
                  },
                  "marketing_channel": {
                    "name": "marketing_channel",
                    "description": "营销事件选择的渠道● search ● display ● social ● email ● referral ● sms",
                    "type": "string",
                    "example": "search"
                  },
                  "ended_at": {
                    "name": "ended_at",
                    "description": "结束时间",
                    "type": "string",
                    "example": "2023-12-15T09:00:00+08:00"
                  },
                  "utm_content": {
                    "name": "utm_content",
                    "description": "区分同一个广告不同的链接",
                    "type": "string",
                    "example": "googleAds"
                  },
                  "utm_term": {
                    "name": "utm_term",
                    "description": "标识搜索的关键字",
                    "type": "string",
                    "example": "This is search word for utm item"
                  },
                  "marketing_event_id": {
                    "name": "marketing_event_id",
                    "description": "营销事件的唯一id",
                    "type": "string",
                    "example": "MA_6019943243021559089"
                  },
                  "manage_url": {
                    "name": "manage_url",
                    "description": "管理页的url（示例url仅提供参考）",
                    "type": "string",
                    "example": "https://manong.myshopline.com/admin/"
                  },
                  "referring_domain": {
                    "name": "referring_domain",
                    "description": "营销事件的目的域名,如果marketing_channel是search和social的时候，需要指定",
                    "type": "string",
                    "example": "manong.myshopline.com"
                  },
                  "utm_source": {
                    "name": "utm_source",
                    "description": "广告客户、广告网站",
                    "type": "string",
                    "example": "manong.myshopline.com"
                  },
                  "utm_campaign": {
                    "name": "utm_campaign",
                    "description": "标识具体的广告",
                    "type": "string",
                    "example": "google"
                  },
                  "preview_url": {
                    "name": "preview_url",
                    "description": "预览页的url（示例url仅提供参考）",
                    "type": "string",
                    "example": "https://manong.myshopline.com"
                  },
                  "remote_id": {
                    "name": "remote_id",
                    "description": "资源id",
                    "type": "string",
                    "example": "6019942645165466925"
                  },
                  "utm_medium": {
                    "name": "utm_medium",
                    "description": "标识来源类型",
                    "type": "string",
                    "example": "email"
                  }
                },
                "example": {
                  "event_type": "ad",
                  "id": "4073",
                  "marketing_channel": "search",
                  "preview_url": "https://manong.myshopline.com",
                  "description": "This is description for marketing event",
                  "referring_domain": "manong.myshopline.com",
                  "marketing_event_id": "MA_6019943243021559089",
                  "utm_content": "googleAds",
                  "remote_id": "6019942645165466925",
                  "utm_campaign": "google",
                  "manage_url": "https://manong.myshopline.com/admin/",
                  "utm_source": "manong.myshopline.com",
                  "ended_at": "2023-12-15T09:00:00+08:00",
                  "utm_term": "This is search word for utm item",
                  "utm_medium": "email",
                  "started_at": "2022-12-15T09:00:00+08:00"
                }
              }
            },
            "example": {
              "marketing_event": {
                "marketing_channel": "search",
                "remote_id": "6019942645165466925",
                "ended_at": "2023-12-15T09:00:00+08:00",
                "utm_campaign": "google",
                "description": "This is description for marketing event",
                "event_type": "ad",
                "utm_medium": "email",
                "utm_term": "This is search word for utm item",
                "started_at": "2022-12-15T09:00:00+08:00",
                "marketing_event_id": "MA_6019943243021559089",
                "utm_source": "manong.myshopline.com",
                "referring_domain": "manong.myshopline.com",
                "id": "4073",
                "preview_url": "https://manong.myshopline.com",
                "utm_content": "googleAds",
                "manage_url": "https://manong.myshopline.com/admin/"
              }
            }
          },
          "examples": {
            "创建一个营销事件": {
              "value": {
                "marketing_event": {
                  "id": 4355,
                  "event_type": "ad",
                  "manage_url": "https://manong.myshopline.com/admin/",
                  "description": "This is description for marketing event",
                  "remote_id": "6019932248291157288",
                  "started_at": "2022-12-15T09:00:00+08:00",
                  "utm_term": "This is search word for utm item",
                  "marketing_channel": "search",
                  "referring_domain": "manong.myshopline.com",
                  "utm_medium": "email",
                  "ended_at": "2023-12-15T09:00:00+08:00",
                  "utm_content": "googleAds",
                  "preview_url": "https://manong.myshopline.com/",
                  "marketing_event_id": "MA_6062143268514178052",
                  "utm_source": "manong.myshopline.com",
                  "utm_campaign": "google"
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "name": "errors",
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          },
          "examples": {
            "创建一个非法event type的营销事件": {
              "value": {}
            },
            "创建一个非法marketing channel的营销事件": {
              "value": {}
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "请求的全局唯一标识符。用于追踪请求在系统中的流转，以便于问题发生时进行定位和调试。"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "错误描述。",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/sales/marketing_events.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` ：店铺的唯一标识符，值为店铺域名的前缀。例如，域名为 `open001.myshopline.com` 的店铺，其 `handle` 是 `open001` 。"
        }
      }
    }
  ],
  "info": {
    "title": "创建营销事件",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_marketing_event"
  ]
}
```