媒体库
GET accounts/:account_id/media_library¶
检索与当前账号关联的部分或所有媒体库对象详细信息。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/media_library
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
count 可选 |
指定每个不同请求尝试检索的记录数量。 类型:int 默认值: 20 最小值、最大值: 1 、50 |
cursor 可选 |
指定光标以获取下一页结果。参阅分页了解更多信息。 类型:string 示例: |
media_type 可选 |
将响应范围限定至所需的媒体类型。 类型:enum 可能值: |
q 可选 |
可选查询,按 注意:执行不区分大小写的术语匹配。 类型:string 最小、最大长度: 1 、255 |
请求示例¶
GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/media_library?count=1
响应示例¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"count": 1
}
},
"data": [
{
"tweeted": true,
"name": null,
"file_name": "coffee https://t.co/4tcPU9XUon",
"media_url": "https://pbs.twimg.com/media/DJvnJf_UEAAXnzC.jpg",
"media_category": "TWEET_IMAGE",
"media_key": "3_908573900237180928",
"created_at": "2017-09-15T06:11:12Z",
"media_status": "TRANSCODE_COMPLETED",
"media_type": "IMAGE",
"updated_at": "2017-11-16T06:00:01Z",
"deleted": false
}
],
"next_cursor": "c-1"
}
GET accounts/:account_id/media_library/:media_key¶
检索与当前账号关联的特定媒体库对象。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/media_library/:media_key
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
media_key 必需 |
请求中对正在操作的媒体库对象的引用。 类型:string 示例: |
请求示例¶
GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t/media_library/13_909110614026444802
响应示例¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"media_key": "13_909110614026444802"
}
},
"data": {
"tweeted": true,
"duration": 39973,
"name": null,
"file_name": "buildings https://t.co/xFdzrHM5QG",
"description": null,
"media_url": "https://video.twimg.com/amplify_video/909110614026444802/vid/1280x720/mfahmfkKVjjk1nGm.mp4",
"media_category": "AMPLIFY_VIDEO",
"poster_media_url": "https://pbs.twimg.com/amplify_video_thumb/909110614026444802/img/QZUNoaiCia0UFNrw.jpg",
"poster_media_key": "3_909110614026444802",
"media_key": "13_909110614026444802",
"created_at": "2017-09-16T17:43:55Z",
"media_status": "TRANSCODE_COMPLETED",
"title": "buildings",
"media_type": "VIDEO",
"aspect_ratio": "16:9",
"updated_at": "2017-09-27T13:04:00Z",
"deleted": false
}
}
POST accounts/:account_id/media_library¶
将媒体对象关联至当前账号。如需更多详细信息,请参见我们的媒体库指南。
注意:通过 AMPLIFY_VIDEO
媒体类别将视频添加至媒体库时,视频将自动作为PREROLL
account_media 资产以供使用。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/media_library
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
media_key 必需 |
所上传内容的 类型:string 示例: |
description 可选 |
发推后出现在视频下方的说明中。最大长度:200 个字符。 默认情况下,推文中不会提供说明。要显示视频的 注意:仅可用于视频。 类型:string 示例: |
file_name 可选 |
媒体库对象的文件名。最大长度:255。 可在 ads.twitter.com 的媒体库 UI 中查找每个媒体资产的媒体详细信息,其中可查看文件名。未设置 类型:string 示例: |
name 可选 |
媒体库对象名称。最大长度:100。 此参数为 ads.twitter.com 的媒体库 UI 中每个媒体资产的标签。未设置 类型:string 示例: |
poster_media_key 可选 |
使用已上传图像的 注意:仅可用于视频。 类型:string 示例: |
title 可选 |
发推后出现在视频下方的标题中。最大长度:70 个字符。 默认情况下,推文中不会提供说明。要显示视频的 注意:仅可用于视频。 类型:string 示例: |
请求示例¶
POST https://ads-api.twitter.com/10/accounts/18ce54d4x5t/media_library?media_key=3_931236738554519552
响应示例¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"media_key": "3_931236738554519552"
}
},
"data": {
"tweeted": false,
"name": null,
"file_name": null,
"media_url": "https://pbs.twimg.com/media/DOxq4TtV4AAlvh_.jpg",
"media_category": "TWEET_IMAGE",
"media_key": "3_931236738554519552",
"created_at": "2017-11-16T19:05:14Z",
"media_status": "TRANSCODE_COMPLETED",
"media_type": "IMAGE",
"updated_at": "2017-11-16T19:05:23Z",
"deleted": false
}
}
PUT accounts/:account_id/media_library/:media_key¶
更新属于当前账号的指定媒体库对象。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/media_library/:media_key
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
media_key 必需 |
请求中对正在操作的媒体库对象的引用。 类型:string 示例: |
description 可选 |
发推后出现在视频下方的说明中。最大长度:200 个字符。 默认情况下,推文中不会提供说明。要显示视频的 注意:仅可用于视频。 类型:string 示例: |
file_name 可选 |
媒体库对象的文件名。最大长度:255。 可在 ads.twitter.com 的媒体库 UI 中查找每个媒体资产的媒体详细信息,其中可查看文件名。未设置 类型:string 示例: |
name 可选 |
媒体库对象名称。最大长度:100。 此参数为 ads.twitter.com 的媒体库 UI 中每个媒体资产的标签。未设置 类型:string 示例: |
poster_media_key 可选 |
使用已上传图像的 注意:仅可用于视频。 类型:string 示例: |
title 可选 |
发推后出现在视频下方的标题中。最大长度:70 个字符。 默认情况下,推文中不会提供说明。要显示视频的 注意:仅可用于视频。 类型:string 示例: |
请求示例¶
PUT https://ads-api.twitter.com/10/accounts/18ce54d4x5t/media_library/16_844800354743074820?title=cat GIF&description=in space
响应示例¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"media_key": "16_844800354743074820",
"title": "cat GIF",
"description": "in space"
}
},
"data": {
"tweeted": true,
"duration": null,
"name": null,
"file_name": null,
"description": "in space",
"media_url": "https://video.twimg.com/tweet_video/C7lVclqVwAQqTCZ.mp4",
"media_category": "TWEET_GIF",
"poster_media_url": "https://pbs.twimg.com/tweet_video_thumb/C7lVclqVwAQqTCZ.jpg",
"poster_media_key": "3_844800354743074820",
"media_key": "16_844800354743074820",
"created_at": "2017-10-20T09:51:54Z",
"media_status": "TRANSCODE_COMPLETED",
"title": "cat GIF",
"media_type": "GIF",
"aspect_ratio": "125:79",
"updated_at": "2017-10-23T06:37:56Z",
"deleted": false
}
}
DELETE accounts/:account_id/media_library/:media_key¶
删除属于当前账号的指定媒体库对象。
资源 URL¶
https://ads-api.twitter.com/10/accounts/:account_id/media_library/:media_key
参数¶
名称 | 说明 |
---|---|
account_id 必需 |
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts。指定账号必须与已验证的用户关联。 类型:string 示例: |
media_key 必需 |
请求中对正在操作的媒体库对象的引用。 类型:string 示例: |
请求示例¶
DELETE https://ads-api.twitter.com/10/accounts/18ce54d4x5t/media_library/7_860318603387600896
响应示例¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"media_key": "7_860318603387600896"
}
},
"data": {
"tweeted": true,
"duration": 14330,
"name": "mountains-on-ads.twitter.com",
"file_name": "mountains.mp4",
"description": "",
"media_url": "https://video.twimg.com/ext_tw_video/860318603387600896/pu/vid/1280x720/xI3DbvWKxdvICsFW.mp4",
"media_category": "TWEET_VIDEO",
"poster_media_url": "https://pbs.twimg.com/media/C_B3bTRVYAAFBFt.jpg",
"poster_media_key": "3_860318839740915712",
"media_key": "7_860318603387600896",
"created_at": "2017-05-05T02:21:53Z",
"media_status": "TRANSCODE_COMPLETED",
"title": "uploaded on ads.twitter.com",
"media_type": "VIDEO",
"aspect_ratio": "16:9",
"updated_at": "2017-05-05T02:26:58Z",
"deleted": true
}
}