借助 Admin SDK Google Workspace 转销商服务,您可以在 Apps 脚本中使用 Admin SDK Reseller API。此 API 允许已获授权的转销商管理员下达客户订单,并管理 Google Workspace 月度后付费订阅。
参考
如需详细了解此服务,请参阅 Admin SDK Google Workspace Reseller API 的参考文档。与 Apps 脚本中的所有高级服务一样,Admin SDK Google Workspace 转销商服务使用的对象、方法和参数均与公共 API 相同。如需了解详情,请参阅方法签名是如何确定的。
/** * Logs the list of subscriptions, including the customer ID, date created, plan * name, and the sku ID. Notice the use of page tokens to access the full list * of results. * @see https://developers.google.com/admin-sdk/reseller/reference/rest/v1/subscriptions/list */functiongetSubscriptions(){letresult;letpageToken;do{result=AdminReseller.Subscriptions.list({pageToken:pageToken});for(constsubofresult.subscriptions){constcreationDate=newDate();creationDate.setUTCSeconds(sub.creationTime);console.log('customer ID: %s, date created: %s, plan name: %s, sku id: %s',sub.customerId,creationDate.toDateString(),sub.plan.planName,sub.skuId);}pageToken=result.nextPageToken;}while(pageToken);}