网站卡片

注意:要将卡片关联到推文,请通过 POST accounts/:account_id/tweetPOST statuses/updatePOST accounts/:account_id/scheduled_tweets 端点,使用 card_uri 参数来完成。

GET accounts/:account_id/cards/website

检索与当前账号关联的部分或所有网站卡片详细信息。

资源 URL

https://ads-api.twitter.com/10/accounts/:account_id/cards/website

参数

名称 说明
account_id
必需

所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

card_ids
可选

通过指定以逗号分隔的标识符列表,将响应范围限定至所需的网站卡片。最多可提供 200 个 ID。

类型:string

示例:59wh0

count
可选

指定每个不同请求尝试检索的记录数量。

类型:int

默认值:200
最小值、最大值:11000
cursor
可选

指定光标以获取下一页结果。参阅分页了解更多信息。

类型:string

示例:8x7v00oow

q
可选

可选查询,按 name 指定卡片范围。省略此参数可检索所有卡片。最大长度:80 个字符。

注意:执行不区分大小写的前缀匹配。

类型:string

示例:shuttle

sort_by
可选

根据支持的属性,按升序或降序排序。参阅排序了解更多信息。

类型:string

示例:created_at-asc

with_deleted
可选

在请求中包含已删除的结果。

类型:boolean

默认值:false
可能值:truefalse
with_total_count
可选

包含 total_count 响应属性。

注意:不包含此参数和 cursor

注意:包含 total_count 的请求速率限制较低,目前设置为每 15 分钟 200 次。

类型:boolean

默认值:false
可能值:truefalse

请求示例

GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/website?card_ids=59wh0

响应示例

{
  "request": {
    "params": {
      "card_type": "website",
      "card_ids": [
        "59wh0"
      ],
      "account_id": "18ce54d4x5t"
    }
  },
  "next_cursor": null,
  "data": [
    {
      "name": "website card",
      "website_shortened_url": "https://t.co/zadeUSVD18",
      "image_display_height": "418",
      "media_url": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
      "website_display_url": "developer.twitter.com",
      "id": "59wh0",
      "website_dest_url": "https://developer.twitter.com",
      "created_at": "2018-01-27T00:15:19Z",
      "media_key": "3_955505955445268480",
      "image_display_width": "800",
      "website_title": "Twitter Developers",
      "card_uri": "card://957044309437526017",
      "website_url": "https://developer.twitter.com",
      "updated_at": "2018-01-27T00:15:19Z",
      "deleted": false,
      "card_type": "WEBSITE"
    }
  ]
}

GET accounts/:account_id/cards/website/:card_id

检索与当前账号关联的特定网站卡片。

资源 URL

https://ads-api.twitter.com/10/accounts/:account_id/cards/website/:card_id

参数

名称 说明
account_id
必需

所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

card_id
必需

请求中对正在操作的网站卡片的引用。

类型:string

示例:59wh0

with_deleted
可选

在请求中包含已删除的结果。

类型:boolean

默认值:false
可能值:truefalse

请求示例

GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/website/59wh0

响应示例

{
  "request": {
    "params": {
      "card_type": "website",
      "card_id": "59wh0",
      "account_id": "18ce54d4x5t"
    }
  },
  "data": {
    "name": "website card",
    "website_shortened_url": "https://t.co/zadeUSVD18",
    "image_display_height": "418",
    "media_url": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "website_display_url": "developer.twitter.com",
    "id": "59wh0",
    "website_dest_url": "https://developer.twitter.com",
    "created_at": "2018-01-27T00:15:19Z",
    "media_key": "3_955505955445268480",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://957044309437526017",
    "website_url": "https://developer.twitter.com",
    "updated_at": "2018-01-27T00:15:19Z",
    "deleted": false,
    "card_type": "WEBSITE"
  }
}

POST accounts/:account_id/cards/website

创建与当前账号关联的新网站卡片。

资源 URL

https://ads-api.twitter.com/10/accounts/:account_id/cards/website

参数

名称 说明
account_id
必需

所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

media_key
必需

在本卡片中使用的图像媒体密钥。

注意:图像必须位于账号的媒体库

注意:图像最小宽度必须为 800 像素,且宽高比为 1:1 或 1.91:1(宽:高)。

类型:string

示例:3_1151345051104991073

name
必需

卡片名称。

类型:string

示例:website card

website_title
必需

卡片标题。

类型:string

示例:Twitter Developers

website_url
必需

重定向用户转到的网站 URL。

类型:string

示例:https://developer.twitter.com

请求示例

POST https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/website?media_key=3_955505955445268480&name=website card&website_title=Twitter Developers&website_url=https://developer.twitter.com

响应示例

{
  "data": {
    "name": "website card",
    "website_shortened_url": "https://t.co/zadeUSVD18",
    "image_display_height": "418",
    "media_url": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "website_display_url": "developer.twitter.com",
    "id": "59wh0",
    "website_dest_url": "https://developer.twitter.com",
    "created_at": "2018-01-27T00:15:19Z",
    "media_key": "3_955505955445268480",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://957044309437526017",
    "website_url": "https://developer.twitter.com",
    "updated_at": "2018-01-27T00:15:19Z",
    "deleted": false,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "name": "website card",
      "website_shortened_url": "https://t.co/zadeUSVD18",
      "image_display_height": "418",
      "media_url": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
      "media_key": "3_955505955445268480",
      "website_display_url": "developer.twitter.com",
      "account_id": "18ce54d4x5t",
      "website_dest_url": "https://developer.twitter.com",
      "image_display_width": "800",
      "website_title": "Twitter Developers",
      "website_url": "https://developer.twitter.com",
      "card_type": "WEBSITE"
    }
  }
}

PUT accounts/:account_id/cards/website/:card_id

更新属于当前账号的指定网站卡片。

资源 URL

https://ads-api.twitter.com/10/accounts/:account_id/cards/website/:card_id

参数

名称 说明
account_id
必需

所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

card_id
必需

请求中对正在操作的网站卡片的引用。

类型:string

示例:4i91t

media_key
可选

在本卡片中使用的图像媒体密钥。

注意:图像必须位于账号的媒体库

注意:图像最小宽度必须为 800 像素,且宽高比为 1:1 或 1.91:1(宽:高)。

类型:string

示例:3_1151345051104991073

name
可选

卡片名称。

类型:string

示例:coffee card

website_title
可选

卡片标题。

类型:string

示例:Twitter Developers

website_url
可选

重定向用户转到的网站 URL。

类型:string

示例:https://twittercommunity.com/c/advertiser-api

请求示例

PUT https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/website/59w2c?name=coffee card

响应示例

{
  "data": {
    "name": "coffee card",
    "website_shortened_url": "https://t.co/TvmIOd0wXq",
    "image_display_height": "418",
    "media_url": "https://pbs.twimg.com/media/DUKjmp8V4AAhrrB.jpg",
    "website_display_url": "developer.twitter.com",
    "id": "59w2c",
    "website_dest_url": "https://developer.twitter.com/",
    "created_at": "2018-01-26T21:11:48Z",
    "media_key": "3_955505955445268480",
    "image_display_width": "800",
    "website_title": "Twitter Developers",
    "card_uri": "card://956998127856177153",
    "website_url": "https://developer.twitter.com/",
    "updated_at": "2018-01-27T00:20:18Z",
    "deleted": false,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "account_id": "18ce54d4x5t",
      "card_type": "WEBSITE",
      "card_id": "59w2c",
      "name": "coffee card"
    }
  }
}

DELETE accounts/:account_id/cards/website/:card_id

永久删除属于当前账号的指定网站卡片。

注意:此操作为硬删除。删除后,将无法恢复删除的卡片。

资源 URL

https://ads-api.twitter.com/10/accounts/:account_id/cards/website/:card_id

参数

名称 说明
account_id
必需

所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

card_id
必需

请求中对正在操作的网站卡片的引用。

类型:string

示例:4i91t

请求示例

DELETE https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/website/4i91t

响应示例

{
  "data": {
    "name": "website card",
    "id": "4i91t",
    "created_at": "2017-07-08T06:05:17Z",
    "updated_at": "2017-08-23T13:33:50Z",
    "deleted": true,
    "card_type": "WEBSITE"
  },
  "request": {
    "params": {
      "card_id": "4i91t",
      "card_type": "website",
      "account_id": "18ce54d4x5t"
    }
  }
}