检索和更新订阅

检索订阅后,您可以使用 成功响应了 更改订阅状态 或更新订阅。本页重点介绍了 检索和更新订阅。

检索订阅

要检索已成功订购或转移的订阅,请使用 后续 GETHTTP 请求。

GET https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID

替换以下内容:

此操作在请求正文中没有任何参数。

成功的响应会返回 HTTP 200 状态 代码以及订阅设置。在以下示例响应中, isInTrial 属性为“false”,但没有 trialEndTime 媒体资源,这意味着此客户从未使用过 免费试用此方案 30 天。

{
  "kind": "reseller#subscription",
  "customerId": "C0123456",
  "subscriptionId": "123",
  "skuId": "1010020028",
  "billingMethod": "ONLINE",
  "creationTime": "1331647980142",
  "plan": {
    "planName": "ANNUAL",
    "isCommitmentPlan": true,
    "commitmentInterval": {
      "startTime": "1331647980142",
      "endTime": "1363183980142"
    }
  },
  "seats": {
    "kind": "subscriptions#seats",
    "numberOfSeats": 10,
    "licensedNumberOfSeats": 10
  },
  "trialSettings": {
    "isInTrial": false
  },
  "renewalSettings": {
    "kind": "subscriptions#renewalSettings",
    "renewalType": "RENEW_CURRENT_USERS_MONTHLY_PAY"
  },
  "purchaseOrderId": "example.com_annual_1",
  "status": "ACTIVE",
  "resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
  "skuName": "Google Workspace Business Standard"
}

检索客户的所有订阅

要检索特定转销商客户已被 已成功订购或转移,请使用以下 GET HTTP 请求和 包含授权令牌:

GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerId=CUSTOMER_ID value&pageToken=START_DATE&maxResults=MAX_NUMBER

替换以下内容:

  • CUSTOMER_ID:客户的主域名 名称或客户的唯一标识符。
  • START_DATE:格式为 YYYY-MM-DD
  • MAX_NUMBER:返回的结果数上限 。

此操作在请求正文中没有任何参数。

成功的响应将返回一个 HTTP 200 状态代码以及一系列 客户的订阅和设置。订阅列表可能包括 不受此版本转销商 API 管理的产品。

如果您不负责管理该客户,使其不受管理,则系统会显示 403 "Forbidden" 错误 返回。

检索客户的所有可转移订阅

检索客户所有可能被 转移到转销商管理,请使用以下 GET HTTP 请求 并附上授权令牌通过 customerId 是必需项,当 检索转销商客户的账号customerAuthToken是您的客户提供的转移令牌, 您的转销商 ID 专用。由客户生成后,有效期为 30 天。如需详细了解客户如何生成令牌,请参阅 将您的 Google Workspace 账号转移给转销商

GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerId=CUSTOMER_ID&customerAuthToken=AUTH_TOKEN&pageToken=START_DATE&maxResults=MAX_NUMBER

替换以下内容:

  • CUSTOMER_ID:客户的主域名 名称或客户的唯一标识符。
  • AUTH_TOKEN:您的 您的客户。由 其有效期为 30 天。如需详细了解客户如何 生成令牌,请参阅 将您的 Google Workspace 账号转移给转销商。 如果此值无效或已过期,API 响应会返回 403 "Forbidden" 个错误。
  • START_DATE:格式为 YYYY-MM-DD
  • MAX_NUMBER:返回的结果数上限 。

此操作在请求正文中没有任何参数。

成功的响应将返回一个 HTTP 200 状态代码以及一系列 客户的可转移订阅以及转移到期日期 令牌和转移订单所需的最小席位数。客户 可能会持有其他不可转移的订阅。

{
  "kind": "reseller#subscriptions",
  "subscriptions": [
    {
      "kind": "subscriptions#subscription",
      "customerId": "custId-6543",
      "subscriptionId": "432",
      "skuId": "1010020028",
      "billingMethod": "ONLINE",
      "creationTime": "1331647980142",
      "plan": {
        "planName": "ANNUAL",
        "isCommitmentPlan": true,
        "commitmentInterval": {
          "startTime": "1331647980142",
          "endTime": "1363183980142"
        }
      },
      "seats": {
        "kind": "subscriptions#seats",
        "numberOfSeats": 10,
        "maximumNumberOfSeats": 500,
        "licensedNumberOfSeats": 10
      },
      "trialSettings": {
        "isInTrial": false
      },
      "renewalSettings": {
        "kind": "subscriptions#renewalSettings",
        "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
      },
      "transferInfo": {
        "transferabilityExpirationTime": "1333183980142",
        "minimumTransferableSeats": "20"
      },
      "purchaseOrderId": "PO_890",
      "status": "ACTIVE",
      "resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
      "skuName": "Google Workspace Business Standard"
    },
    {
      "kind": "subscriptions#subscription",
      "customerId": "custId-6543",
      "subscriptionId": "140",
      "skuId": "1010020028",
      "creationTime": "1329389322728",
      "plan": {
        "planName": "FLEXIBLE",
        "isCommitmentPlan": false
      },
      "seats": {
        "kind": "subscriptions#seats",
        "maximumNumberOfSeats": 50
        "licensedNumberOfSeats": 10
      },
      "trialSettings": {
        "isInTrial": false,
        "trialEndTime": "1331877480016"
      },
      "renewalSettings": {
        "kind": "subscriptions#renewalSettings",
        "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
      },
      "transferInfo": {
        "transferabilityExpirationTime": "1333183780159",
        "minimumTransferableSeats": "10"
      },
      "purchaseOrderId": "",
      "status": "ACTIVE",
      "resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
      "skuName": "Google Workspace Business Standard"
    },
  ],
  "nextPageToken": "token"
}

如果您打算使用批量模式转移这些订阅 操作,转移所有订阅。转移每个订阅 都会导致错误。此外,批量操作 状态为 ACTIVE 的订阅。如需了解详情,请参阅 转移订阅

检索所有转销商订阅

要检索转销商成功订购或转让的所有 订阅,请使用以下 GET HTTP 请求并包含授权令牌。

GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerNamePrefix=PREFIX &pageToken=TOKEN&maxResults=MAX_NUMBER

替换以下内容:

  • PREFIX:客户名称的开头, 查找所需的订阅
  • TOKEN:标识特定页面的令牌, 结果。
  • MAX_NUMBER:返回的结果数上限 。

此操作可以使用 OAuth 只读访问权限范围。通过 customerNamePrefixpageTokenmaxResults 均为可选查询字符串。

以下示例检索属于某个转销商的所有 名称以“exam”开头的客户:

GET https://reseller.googleapis.com/apps/reseller/v1/subscriptions?customerNamePrefix=exam

{
  "kind": "reseller#subscriptions",
  "subscriptions": [
    {
      "kind": "subscriptions#subscription",
      "customerId": "C0123456",
      "subscriptionId": "123",
      "skuId": "1010020028",
      "creationTime": "1331647980142",
      "billingMethod": "ONLINE",
      "plan": {
        "planName": "ANNUAL",
        "isCommitmentPlan": true,
        "commitmentInterval": {
          "startTime": "1331647980142",
          "endTime": "1363183980142"
        }
      },
      "seats": {
        "kind": "subscriptions#seats",
        "numberOfSeats": 10,
        "licensedNumberOfSeats": 10
      },
      "trialSettings": {
        "isInTrial": false
      },
      "renewalSettings": {
        "kind": "subscriptions#renewalSettings",
        "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
      },
      "purchaseOrderId": "PO_135",
      "status": "ACTIVE",
      "resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
      "skuName": "Google Workspace Business Standard"
    },
    {
      "kind": "subscriptions#subscription",
      "customerId": "custId-5678",
      "subscriptionId": "1404686",
      "skuId": "1010020028",
      "billingMethod": "ONLINE",
      "creationTime": "1329389322728",
      "plan": {
        "planName": "FLEXIBLE",
        "isCommitmentPlan": false
      },
      "seats": {
        "kind": "subscriptions#seats",
        "maximumNumberOfSeats": 50,
        "licensedNumberOfSeats": 10
      },
      "trialSettings": {
        "isInTrial": false,
        "trialEndTime": "1331877480016"
      },
      "renewalSettings": {
        "kind": "subscriptions#renewalSettings",
        "renewalType": "AUTO_RENEW"
      },
      "purchaseOrderId": "",
      "status": "ACTIVE",
      "resourceUiUrl": "URL to customer's Subscriptions page in the Admin console",
      "skuName": "Google Workspace Business Standard"
    },
  ],
  "nextPageToken": "token"
}

更新订阅方案

Google Workspace 方案的更新方式因方案而异。更新之前 可以考虑以下事项:

  • 当您创建订阅且客户符合条件时, 订阅的方案可以是 30 天试用期。弹性方案和包年套餐 合约付款方案可以免费试用 30 天。在试用期内,您 可将订阅的付款方案更改为弹性方案或包年套餐 承诺方案的频率。但在试用结束后 启用,更新方案所遵循的规则与其他 个订阅的有效方案。要立即将试用订阅转移到 有效方案 在为期 30 天的免费试用订阅中开始一项付费服务。 有关 30 天试用的更多信息和客户资格审查规则,请参阅 管理帮助中心

  • 您可以将弹性方案更新为包年套餐。

  • 您无法更新包年套餐。

  • 并非所有方案都适用于所有产品。如需详细了解 个产品已被这些方案使用,请参阅 产品和SKU

将试用期为 30 天的方案更新为包年套餐,或将弹性方案订阅为包年方案 则使用以下 POST HTTP 请求:

POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changePlan

替换以下内容:

以下示例使用 subscriptionId 更新订阅,具体值为 值为 123customerId 为 C0123456。

POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/changePlan

请求正文包含以下内容:

{
  "kind": "reseller#changePlanRequest",
  "planName": "ANNUAL_MONTHLY_PAY",
  "seats": {
    "kind": "subscriptions#seats",
    "numberOfSeats": 10
  },
  "purchaseOrderId": "123_March2012"
}

成功的响应会返回 HTTP 201 状态代码,并返回更新后的 订阅方案设置:

{
  "kind": "reseller#subscription",
  "customerId": "C0123456",
  "subscriptionId": "123",
  "skuId": "1010020028",
  "creationTime": "1331647980142",
  "plan": {
    "planName": "ANNUAL",
    "isCommitmentPlan": true,
    "commitmentInterval": {
      "startTime": "1331647980142",
      "endTime": "1363183980142"
    }
  },
  "seats": {
    "kind": "subscriptions#seats",
    "numberOfSeats": 10,
    "licensedNumberOfSeats": 10
  },
  "trialSettings": {
    "isInTrial": false
  },
  "renewalSettings": {
    "kind": "subscriptions#renewalSettings",
    "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
  },
  "purchaseOrderId": "123_March2012",
  "status": "ACTIVE",
  "skuName": "Google Workspace Business Standard"
}

更新订阅的席位

更新包年套餐订阅时使用的是不同的订阅 属性与更新 Google Workspace 弹性方案订阅相比。

更新包年套餐订阅的席位

要更新包年套餐订阅的用户许可设置,请使用以下代码: POST HTTP 请求:

POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changeSeats

替换以下内容:

以下示例使用 123 subscriptionId 更新订阅。通过 customerId 为 C0123456。请求的正文会有所不同,具体取决于 方案类型:

POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/changeSeats

Google Workspace 包年套餐的订阅使用此请求正文 更新用户许可的数量。numberOfSeats 值是 总计。举例来说,如果您之前有 10 个用户许可, 客户订购 5 个新许可,请求正文中的 numberOfSeats 为 15,如以下示例所示:

{
    "kind": "subscriptions#seats",
    "numberOfSeats": 15
}

更新弹性方案订阅的席位

Google Workspace 弹性方案的订阅使用请求正文进行更新 用户许可。maximumNumberOfSeats 值是 现有许可和新许可这是用户数量上限 许可分配数量。

{
  "kind": "subscriptions#seats",
  "maximumNumberOfSeats": 15
}

成功的响应将返回一个 HTTP 201 状态代码以及更新后的 订阅许可设置:

{
  "kind": "reseller#subscription",
  "customerId": "C0123456",
  "subscriptionId": "123",
  "skuId": "1010020028",
  "creationTime": "1331647980142",
  "plan": {
    "planName": "FLEXIBLE",
    "isCommitmentPlan": false
  },
  "seats": {
    "kind": "subscriptions#seats",
    "maximumNumberOfSeats": 15,
    "licensedNumberOfSeats": 10
  },
  "trialSettings": {
    "isInTrial": false
  },
  "skuName": "Google Workspace Business Standard"
}

更新订阅的续订设置

要更新包年承诺订阅的续订设置,请使用 以下 POST HTTP 请求:

POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/changeRenewalSettings

替换以下内容:

以下是一个示例请求正文:

{
  "kind": "subscriptions#renewalSettings",
  "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
}

renewalType 属性的值可以是下列任一值:

  • AUTO_RENEW_YEARLY_PAY:在包年承诺方案的间隔结束时, 使用ANNUAL_YEARLY_PAY 相同的 numberOfSeats
  • AUTO_RENEW_MONTHLY_PAY:包年套餐的 按时间间隔自动续订订阅方案 具有同一 numberOfSeatsANNUAL_MONTHLY_PAY
  • RENEW_CURRENT_USERS_YEARLY_PAY:包年套餐的 按 ANNUAL_YEARLY_PAY 续订订阅的方案,但使用 当前活跃用户许可的总数。这是默认设置 有效包年套餐(按年付款)的设置。
  • RENEW_CURRENT_USERS_MONTHLY_PAY:包年套餐的 按 ANNUAL_MONTHLY_PAY 续订订阅的方案,但使用 当前活跃用户许可的总数。这是默认设置 有效包年套餐(按月付款)的设置。
  • RENEW_ON_PROPOSED_OFFER:当前承诺方案的时长结束时 间隔,续订以 numberOfSeats 为编号的最新续订提案 当前有效的用户许可或建议的优惠承诺(以 。
  • SWITCH_TO_PAY_AS_YOU_GO:包年套餐的 请将包年套餐更改为弹性方案。
  • CANCEL:在包年套餐间隔结束时,订阅 已暂停。要了解如何解除暂停状态,请参阅 管理帮助中心

成功的响应将返回一个 HTTP 201 状态代码以及更新后的 订阅续订设置:

{
  "kind": "reseller#subscription",
  "customerId": "C0123456",
  "subscriptionId": "123",
  "skuId": "1010020028",
  "creationTime": "1331647980142",
  "plan": {
    "planName": "ANNUAL",
    "isCommitmentPlan": true,
    "commitmentInterval": {
      "startTime": "1331647980142",
      "endTime": "1363183980142"
    }
  },
  "seats": {
    "kind": "subscriptions#seats",
    "numberOfSeats": 15,
    "licensedNumberOfSeats": 15
  },
  "trialSettings": {
    "isInTrial": false
  },
  "renewalSettings": {
    "kind": "subscriptions#renewalSettings",
    "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
  },
  "skuName": "Google Workspace Business Standard"
}

通过免费试用订阅启用付费服务

立即将为期 30 天的免费试用订阅转移到付费服务 订阅(如果已针对试用设置了付款方案) 订阅,请使用以下 POST HTTP 请求。

POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions/SUBSCRIPTION_ID/startPaidService

替换以下内容:

以下示例使用 C0123456 作为 customerId,将 subscriptionId 值 123:

POST https://reseller.googleapis.com/apps/reseller/v1/customers/C0123456/subscriptions/123/startPaidService

此操作在请求正文中没有任何参数。

成功的响应会返回 HTTP 201 状态代码和更新后的订阅设置:

{
  "kind": "reseller#subscription",
  "customerId": "C0123456",
  "subscriptionId": "123",
  "skuId": "1010020028",
  "creationTime": "1331647980142",
  "plan": {
    "planName": "ANNUAL",
    "isCommitmentPlan": true,
    "commitmentInterval": {
      "startTime": "1331647980142",
      "endTime": "1363183980142"
    }
  },
  "seats": {
    "kind": "subscriptions#seats",
    "numberOfSeats": 15,
    "licensedNumberOfSeats": 15
  },
  "trialSettings": {
    "isInTrial": false
  },
  "renewalSettings": {
    "kind": "subscriptions#renewalSettings",
    "renewalType": "SWITCH_TO_PAY_AS_YOU_GO"
  },
  "skuName": "Google Workspace Business Standard"
}

升级或降级订阅

您无法在包年方案订阅期内降级 使用续订设置安排降级。我们建议您将 续订设置改用 FLEXIBLE,然后在续订期满后降级。

如需升级或降级订阅,请创建新订阅 替换为要升级或降级到的 skuId

POST https://reseller.googleapis.com/apps/reseller/v1/customers/CUSTOMER_ID/subscriptions

替换以下内容:

  • CUSTOMER_ID:客户的主域名 名称或客户的唯一标识符。

此调用将终止先前的订阅并创建新订阅。

详细了解 升级和降级 产品与SKU 页面。