图像私信卡片
注意:要将卡片关联到推文,请通过 POST accounts/:account_id/tweet、POST statuses/update 或 POST accounts/:account_id/scheduled_tweets 端点,使用 card_uri
参数来完成。
GET accounts/:account_id/cards/image_direct_message¶
检索与当前账号关联的部分或所有图像私信卡片详细信息。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/cards/image_direct_message
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
card_ids 可选 |
通过指定以逗号分隔的标识符列表,将响应范围限定至所需的图像私信卡片。最多可提供 200 个 ID。 类型:string 示例: |
count 可选 |
指定每个不同请求尝试检索的记录数量。 类型:int 默认值: 200 最小值、最大值: 1 、1000 |
cursor 可选 |
指定光标以获取下一页结果。参阅分页了解更多信息。 类型:string 示例: |
q 可选 |
可选查询,按 注意:执行不区分大小写的前缀匹配。 类型:string 示例: |
sort_by 可选 |
根据支持的属性,按升序或降序排序。参阅排序了解更多信息。 类型:string 示例: |
with_deleted 可选 |
在请求中包含已删除的结果。 类型:boolean 默认值: false 可能值: true 、false |
with_total_count 可选 |
包含 注意:不包含此参数和 注意:包含 类型:boolean 默认值: false 可能值: true 、false |
请求示例¶
GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/image_direct_message?card_ids=59wpi
响应示例¶
{
"request": {
"params": {
"card_type": "image_direct_message",
"card_ids": [
"59wpi"
],
"account_id": "18ce54d4x5t"
}
},
"next_cursor": null,
"data": [
{
"name": "space card",
"first_cta": "DM me",
"first_cta_welcome_message_id": "865707372148174852",
"image_display_height": "418",
"media_url": "https://pbs.twimg.com/media/DUfy_2JU8AAMAOk.jpg",
"recipient_user_id": "756201191646691328",
"id": "59wpi",
"created_at": "2018-01-27T05:44:31Z",
"media_key": "3_957000624519835648",
"image_display_width": "800",
"card_uri": "card://957127157993500678",
"updated_at": "2018-01-30T01:33:49Z",
"deleted": false,
"card_type": "IMAGE_DIRECT_MESSAGE"
}
]
}
GET accounts/:account_id/cards/image_direct_message/:card_id¶
检索属于当前账号的特定图像私信卡片。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/cards/image_direct_message/:card_id
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
card_id 必需 |
请求中对正在操作的图像私信卡片的引用。 类型:string 示例: |
with_deleted 可选 |
在请求中包含已删除的结果。 类型:boolean 默认值: false 可能值: true 、false |
请求示例¶
GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/image_direct_message/59wpi
响应示例¶
{
"request": {
"params": {
"card_type": "image_direct_message",
"card_id": "59wpi",
"account_id": "18ce54d4x5t"
}
},
"data": {
"name": "space card",
"first_cta": "DM me",
"first_cta_welcome_message_id": "865707372148174852",
"image_display_height": "418",
"media_url": "https://pbs.twimg.com/media/DUfy_2JU8AAMAOk.jpg",
"recipient_user_id": "756201191646691328",
"id": "59wpi",
"created_at": "2018-01-27T05:44:31Z",
"media_key": "3_957000624519835648",
"image_display_width": "800",
"card_uri": "card://957127157993500678",
"updated_at": "2018-01-30T01:33:49Z",
"deleted": false,
"card_type": "IMAGE_DIRECT_MESSAGE"
}
}
POST accounts/:account_id/cards/image_direct_message¶
创建与当前账号关联的新图像私信卡片。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/cards/image_direct_message
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
first_cta 必需 |
第一个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
first_cta_welcome_message_id 必需 |
要与第一个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
media_key 必需 |
在本卡片中使用的图像媒体密钥。 注意:图像必须位于账号的媒体库。 注意:图像最小宽度必须为 800 像素,且宽高比为 1.91:1(宽:高)。 类型:string 示例: |
name 必需 |
卡片名称。 类型:string 示例: |
recipient_user_id 必需 |
从与卡片交互的用户角度来看,与其启动对话的用户。 注意:此参数所指用户必须是指定欢迎私信的拥有者。 类型:long 示例: |
second_cta 可选 |
第二个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
second_cta_welcome_message_id 可选 |
要与二个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
third_cta 可选 |
第三个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
third_cta_welcome_message_id 可选 |
要与第三个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
fourth_cta 可选 |
第四个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
fourth_cta_welcome_message_id 可选 |
要与第四个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
请求示例¶
POST https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/image_direct_message?first_cta=DM me&first_cta_welcome_message_id=865707372148174852&media_key=3_957000624519835648&name=direct message card&recipient_user_id=756201191646691328
响应示例¶
{
"data": {
"name": "direct message card",
"first_cta": "DM me",
"first_cta_welcome_message_id": "865707372148174852",
"image_display_height": "418",
"media_url": "https://pbs.twimg.com/media/DUfy_2JU8AAMAOk.jpg",
"recipient_user_id": "756201191646691328",
"id": "59wpi",
"created_at": "2018-01-27T05:44:31Z",
"media_key": "3_957000624519835648",
"image_display_width": "800",
"card_uri": "card://957127157993500678",
"updated_at": "2018-01-27T05:44:31Z",
"deleted": false,
"card_type": "IMAGE_DIRECT_MESSAGE"
},
"request": {
"params": {
"name": "direct message card",
"first_cta": "DM me",
"first_cta_welcome_message_id": "865707372148174852",
"image_display_height": "418",
"media_url": "https://pbs.twimg.com/media/DUfy_2JU8AAMAOk.jpg",
"recipient_user_id": "756201191646691328",
"media_key": "3_957000624519835648",
"account_id": "18ce54d4x5t",
"image_display_width": "800",
"card_type": "IMAGE_DIRECT_MESSAGE"
}
}
}
PUT accounts/:account_id/cards/image_direct_message¶
更新属于当前账号的指定图像私信卡片。
注意:无法更新 recipient_user_id
,因为所有欢迎私信必须属于创建 (POST) 请求中指定的用户。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/cards/image_direct_message/:card_id
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
card_id 必需 |
请求中对正在操作的图像私信卡片的引用。 类型:string 示例: |
first_cta 可选 |
第一个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
first_cta_welcome_message_id 可选 |
要与第一个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
second_cta 可选 |
第二个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
second_cta_welcome_message_id 可选 |
要与二个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
third_cta 可选 |
第三个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
third_cta_welcome_message_id 可选 |
要与第三个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
fourth_cta 可选 |
第四个选项的行动号召 (CTA) 文本。最大长度:20 个字符。 类型:string 示例: |
fourth_cta_welcome_message_id 可选 |
要与第四个 CTA 关联的欢迎私信 ID。 注意:此欢迎私信必须属 类型:long 示例: |
media_key 可选 |
在本卡片中使用的图像媒体密钥。 注意:图像必须位于账号的媒体库。 注意:图像最小宽度必须为 800 像素,且宽高比为 1.91:1(宽:高)。 类型:string 示例: |
name 可选 |
卡片名称。 类型:string 示例: |
请求示例¶
PUT https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/image_direct_message/59wpi?name=space card
响应示例¶
{
"data": {
"name": "space card",
"first_cta": "DM me",
"first_cta_welcome_message_id": "865707372148174852",
"image_display_height": "418",
"media_url": "https://pbs.twimg.com/media/DUfy_2JU8AAMAOk.jpg",
"recipient_user_id": "756201191646691328",
"id": "59wpi",
"created_at": "2018-01-27T05:44:31Z",
"media_key": "3_957000624519835648",
"image_display_width": "800",
"card_uri": "card://957127157993500678",
"updated_at": "2018-01-30T01:33:49Z",
"deleted": false,
"card_type": "IMAGE_DIRECT_MESSAGE"
},
"request": {
"params": {
"account_id": "18ce54d4x5t",
"card_type": "IMAGE_DIRECT_MESSAGE",
"card_id": "59wpi",
"name": "space card"
}
}
}
DELETE accounts/:account_id/cards/image_direct_message/:card_id¶
永久删除属于当前账号的指定图像私信卡片。
注意:此操作为硬删除。删除后,将无法恢复删除的卡片。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/cards/image_direct_message/:card_id
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
card_id 必需 |
请求中对正在操作的图像私信卡片的引用。 类型:string 示例: |
请求示例¶
DELETE https://ads-api.twitter.com/10/accounts/18ce54d4x5t/cards/image_direct_message/4zi61
响应示例¶
{
"data": {
"name": "DM card",
"id": "4zi61",
"created_at": "2017-11-05T06:17:13Z",
"updated_at": "2017-11-05T06:37:21Z",
"deleted": true,
"card_type": "IMAGE_DIRECT_MESSAGE"
},
"request": {
"params": {
"card_id": "4zi61",
"card_type": "image_direct_message",
"account_id": "18ce54d4x5t"
}
}
}