账号

GET accounts

针对验证用户有权访问的部分或所有支持广告的账号,检索相关详细信息。

资源 URL

https://ads-api.twitter.com/10/accounts

参数

名称 说明
account_ids
可选
通过指定以逗号分隔的标识符列表,将响应范围限定为所需的账号 ID。

类型:string

示例:18ce54d4x5t
count
可选
指定每个不同请求尝试检索的记录数量。

类型:int

默认值:200
最小值、最大值:11000
cursor
可选
指定光标以获取下一页结果。参阅分页了解更多信息。

类型:string

示例:8x7v00oow
q
可选
可选查询,按name 指定资源范围。

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

类型:string

最小、最大长度:1255
sort_by
可选
根据支持的属性,按升序或降序排序。参阅排序了解更多信息。

类型:string

示例:created_at-asc
with_deleted
可选
在请求中包含已删除的结果。

类型:boolean

默认值:false
可能值:truefalse
with_total_count
optional
包含 total_count 响应属性。

注意:不包含此参数和 cursor

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

类型:boolean

默认值:false
可能值:truefalse

请求示例

GET https://ads-api.twitter.com/10/accounts?account_ids=18ce54d4x5t

响应示例

   {
     "request": {
       "params": {
         "account_ids": [
           "18ce54d4x5t"
         ]
       }
     },
     "next_cursor": null,
     "data": [
       {
         "name": "API McTestface",
         "business_name": null,
         "timezone": "America/Los_Angeles",
         "timezone_switch_at": "2016-07-21T07:00:00Z",
         "id": "18ce54d4x5t",
         "created_at": "2016-07-21T22:42:09Z",
         "updated_at": "2017-07-06T16:51:04Z",
         "business_id": null,
         "approval_status": "ACCEPTED",
         "deleted": false
       }
     ]
   }

GET accounts/:account_id

检索验证用户有权访问的特定账号。

资源 URL

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

参数

名称 说明
account_id
必需
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts

指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t
with_deleted
optional
在请求中包含已删除的结果。

类型:boolean

默认值:false
可能值:truefalse

请求示例

GET https://ads-api.twitter.com/10/accounts/18ce54d4x5t

响应示例

   {
     "request": {
       "params": {
         "account_id": "18ce54d4x5t"
       }
     },
     "data": {
       "name": "API McTestface",
       "business_name": null,
       "timezone": "America/Los_Angeles",
       "timezone_switch_at": "2016-07-21T07:00:00Z",
       "id": "18ce54d4x5t",
       "created_at": "2016-07-21T22:42:09Z",
       "updated_at": "2017-07-06T16:51:04Z",
       "industry_type": "TRAVEL",
       "business_id": null,
       "approval_status": "ACCEPTED",
       "deleted": false
     }
   }

POST accounts

注意:仅限沙盒

在沙盒环境中创建广告账号。

资源 URL

https://ads-api-sandbox.twitter.com/10/accounts

参数

请求示例

POST https://ads-api-sandbox.twitter.com/10/accounts

响应示例

   {
     "request": {
       "params": {}
     },
     "next_cursor": null,
     "data": [
       {
         "name": "Sandbox account",
         "business_name": null,
         "timezone": "America/Los_Angeles",
         "timezone_switch_at": null,
         "id": "gq12fh",
         "created_at": "2016-07-18T23:02:20Z",
         "updated_at": "2016-07-18T23:02:20Z",
         "business_id": null,
         "approval_status": "ACCEPTED",
         "deleted": false
       }
     ]
   }

PUT accounts/:account_id

更新账号名称和/或行业类型。

资源 URL

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

参数

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

类型:string

示例:18ce54d4x5t
name
optional
账号名称。

类型:string

示例:API McTestface
industry_type
可选
与账号关联的行业。

类型:string

可能值:AGENCYBUSINESS_TO_BUSINESSONLINE_SERVICESEDUCATIONFINANCIALHEALTHGOVERNMENTMEDIAMOBILERESTAURANTRETAILTECHNOLOGYTRAVELOTHER

请求示例

PUT https://ads-api.twitter.com/10/accounts/18ce54d4x5t?name='API McTestface 2'&industry_type=TECHNOLOGY

响应示例

   {
     "request": {
       "params": {
         "account_id": "18ce54d4x5t"
         "name"": "API McTestface 2",
         "industry_type": "TECHNOLOGY"
       }
     },
     "data": {
       "name": "API McTestface 2",
       "business_name": null,
       "timezone": "America/Los_Angeles",
       "timezone_switch_at": "2016-07-21T07:00:00Z",
       "id": "18ce54d4x5t",
       "created_at": "2016-07-21T22:42:09Z",
       "updated_at": "2017-07-06T16:51:04Z",
       "industry_type": "TECHNOLOGY",
       "business_id": null,
       "approval_status": "ACCEPTED",
       "deleted": false
     }
   }

DELETE accounts/:account_id

注意:仅限沙盒

删除沙盒环境中的广告账号。

资源 URL

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

参数

名称 说明
account_id
required
所使用账号的标识符。出现在资源路径中,通常是所有广告商 API 请求的必要参数,不包含 GET accounts

指定账号必须与已验证的用户关联。

类型:string

示例:18ce54d4x5t

请求示例

DELETE https://ads-api-sandbox.twitter.com/10/accounts/gq12fh

响应示例

   {
     "data": {
       "name": "Sandbox account",
       "timezone": "America/Los_Angeles",
       "timezone_switch_at": null,
       "id": "gq12fh",
       "created_at": "2016-07-18T23:02:20Z",
       "updated_at": "2017-08-23T18:21:10Z",
       "approval_status": "ACCEPTED",
       "deleted": true
     },
     "request": {
       "params": {
         "account_id": "gq12fh"
       }
     }
   }