创建多账户专用网关,根据输入的数据,该网关可以由合作伙伴或广告主来进行管理。
POST https://{capig_domain}/hub/graphql/ _________________________________________________________________________________________________________________ mutation CreateTenantMutation( $input: CreateTenantInput! ) { tenantMutations { createTenant(input: $input) { tenant { id name status canPartnerManage users { id email roles { name displayName } tenants { id name status canPartnerManage availableRoles { name displayName } } isSelf canBeDeleted defaultTenantId } availableRoles { name displayName } tenantUsage { totalActivePixels totalInactivePixels totalPixels tenantUsageByTraffic { totalEventsReceived totalPixelsWithTraffic publishError durationInHours, lastUpdatedAt } } canEditTenantSettingsInUI canViewTenantInUI canEditTenantSettingsInUI } } } } _________________________________________________________________________________________________________ input CreateTenantInput { name: String! canPartnerManage: Boolean! adminEmail: String eventEnrichment: Boolean! }
CreateTenantInput
字段 | 描述 |
---|---|
| 必要 账户的名称 |
| 必要 |
| 可选 |
| 必要 |
CreateTenantResult
字段 | 描述 |
---|---|
| 新创建的租户 |
代码 | 描述 |
---|---|
400 | 提供的输入无效 |
401 | 未获授权,无法创建账户 |
500 | 内部服务器错误 |
更改
mutation CreateTenantMutation( $input: CreateTenantInput! ) { tenantMutations { createTenant(input: $input) { tenant { id name status canPartnerManage } } } }
变量
{ "input": { "name": "TestAdvertiserViaAPI", "canPartnerManage": true, "eventEnrichment": true } }
{ "data": { "tenantMutations": { "createTenant": { "tenant": { "id": "hU2koC34", "name": "TestAdvertiserViaAPI", "status": 0, "canPartnerManage": true } } } } }
删除一个广告主账户。
POST https://{capig_domain}/hub/graphql/ _________________________________________________________________________________________________________________ mutation DeleteTenant($tenantId: String!) { tenantMutations { deleteTenant(tenantId: $tenantId) } } _________________________________________________________________________________________________________ tenantId: String!
字段 | 描述 |
---|---|
| 必要 待删除账户的唯一标识符。 |
布尔值 | 表示租户是否已成功删除。 |
代码 | 描述 |
---|---|
400 | 提供的输入无效 |
401 | 未获授权,无法删除账户 |
500 | 内部服务器错误 |
更改
mutation DeleteTenant($tenantId: String!) { tenantMutations { deleteTenant(tenantId: $tenantId) } }
变量
{ "tenantId": "Tse53QtW" }
{ "data": { "tenantMutations": { "deleteTenant": true } } }
通过加入新名称、状态和权限来更新账户,使某个合作伙伴可以管理此账户。
POST https://{capig_domain}/hub/graphql/ _________________________________________________________________________________________________________________ mutation TenantEditNameModalMutation( $input: UpdateTenantInput! ) { tenantMutations { updateTenant(input: $input) { tenant { id name status canPartnerManage users { id email roles { name displayName } tenants { id name status canPartnerManage availableRoles { name displayName } } isSelf canBeDeleted defaultTenantId } availableRoles { name displayName } tenantUsage { totalActivePixels totalInactivePixels totalPixels tenantUsageByTraffic { totalEventsReceived totalPixelsWithTraffic publishError durationInHours, lastUpdatedAt } } canEditTenantSettingsInUI canViewTenantInUI canEditTenantSettingsInUI } } } } _________________________________________________________________________________________________________ input UpdateTenantInput { tenantId: String! name: String status: Int canPartnerManage: Boolean }
UpdateTenantInput
字段 | 描述 |
---|---|
| 必要 账户的唯一标识符 |
| 可选 账户的名称 |
| 可选 账户状态(参见租户对象) |
| 可选 表示该合作伙伴能否管理此账户 |
TenantMutationResponse
字段 | 描述 |
---|---|
| 已更新的租户 |
代码 | 描述 |
---|---|
400 | 提供的输入无效 |
401 | 未获授权,无法更新租户 |
500 | 内部服务器错误 |
更改
mutation TenantEditNameModalMutation( $input: UpdateTenantInput! ) { tenantMutations { updateTenant(input: $input) { tenant { id name status canPartnerManage } } } }
变量
{ "input":{ "tenantId":"IaoreXfj", "name":"Test Account Name Update", "status":0, "canPartnerManage":true } }
{ "data": { "tenantMutations": { "updateTenant": { "tenant": { "id": "IaoreXfj", "name": "Test Account Name Update", "status": 0, "canPartnerManage": true } } } } }
获取与输入的某个唯一标识符对应的广告主账户。
POST https://{capig_domain}/hub/graphql/ _________________________________________________________________________________________________________________ query TenantAccountUsersViewQuery( $tenantId: String! ) { tenant(tenantId: $tenantId) { id name status canPartnerManage users { id email roles { name displayName } tenants { id name status canPartnerManage availableRoles { name displayName } } isSelf canBeDeleted defaultTenantId } availableRoles { name displayName } tenantUsage { totalActivePixels totalInactivePixels totalPixels tenantUsageByTraffic { totalEventsReceived totalPixelsWithTraffic publishError durationInHours, lastUpdatedAt } } canEditTenantSettingsInUI canViewTenantInUI canEditTenantSettingsInUI } } _________________________________________________________________________________________________________ tenantId: String!
字段 | 描述 |
---|---|
| 必要 待获取账户的唯一标识符 |
字段 | 描述 |
---|---|
| 已获取账户详情 |
代码 | 描述 |
---|---|
401 | 未获授权,无法查看账户 |
500 | 内部服务器错误 |
查询
query TenantAccountUsersViewQuery( $tenantId: String! ) { tenant(tenantId: $tenantId) { id name users { id email roles { name displayName } } } }
变量
{ "tenantId":"wW58k7FQ" }
{ "data": { "tenant": { "id": "wW58k7FQ", "name": "Test Account", "users": [ { "id": "992bc489-a799-4374-8933-0109eed60e3d", "email": "tempuser@test.com", "roles": [ { "name": "advertiser-manage-wW58k7FQ", "displayName": "manage" } ] } ] } } }
获取与此账户某个唯一标识符对应的已工作和未工作的 Pixel 像素代码各自的账户使用情况。此外,系统还将返回一段时间内的流量使用情况统计数据
POST https://{capig_domain}/hub/graphql/ _________________________________________________________________________________________________________________ query TenantUsageQuery( $tenantId: String! ) { tenantUsage(tenantId: $tenantId) { totalActivePixels totalInactivePixels totalPixels tenantUsageByTraffic { totalEventsReceived totalPixelsWithTraffic publishError durationInHours, lastUpdatedAt } } } _________________________________________________________________________________________________________ tenantId: String!
字段 | 描述 |
---|---|
| 必要 账户的唯一标识符 |
字段 | 描述 |
---|---|
| 租户的使用情况 |
代码 | 描述 |
---|---|
401 | 未获授权,无法查看账户使用情况 |
500 | 内部服务器错误 |
查询
query { tenantUsage(tenantId: "IaoreXfj"){ totalActivePixels totalInactivePixels totalPixels } }
{ "data": { "tenantUsage": { "totalActivePixels": 3, "totalInactivePixels": 1, "totalPixels": 4 } } }