有没有订阅的changeSeats函数的工作示例?
我正在为我们的客户自动订购许可证,但我不能让它工作。
我得到了subscriptions.list,但在chageSeats中,我得到了一个警告,告诉我传递的参数数量错误,不幸的是,我不知道应该传递什么,并且在文档中找不到它,只有http get请求……
谢谢你的帮助。
这是我的资料..。
result = AdminReseller.Subscriptions.list({
//have an email address take the domain part (this is already a valid customer of my reseller, checks have been earlier on)
customerId: sheet.getRange(row,2).getValue().split('@')[1],
pageToken: pageToken,
});
for (var i = 0; i < result.subscriptions.length; i++) {
var sub = result.subscriptions[i];
var creationDate = new Date();
creationDate.setUTCSeconds(sub.creationTime);
Logger.log('customer ID: %s, date created: %s, plan name: %s, sku id: %s, subscriptionId: %s, seats: %s, licensed seats: %s',sub.customerId, creationDate.toDateString(), sub.plan.planName,sub.skuId, sub.subscriptionId, sub.seats.numberOfSeats, sub.seats.licensedNumberOfSeats);
//GOOGLE APPS ANNUAL
//If the customer requested apps licenses, we have the SKU and payment plan we expect...
if ((apps) && (sub.skuId=="Google-Apps-For-Business") && (sub.plan.planName=='ANNUAL')){
var totalSeats=apps+sub.seats.numberOfSeats;
var appsReturn = "Buying "+apps+" apps licenses, subID: "+sub.subscriptionId + " in addition to "+sub.seats.numberOfSeats+" total Seats: "+totalSeats+"\n";
//Up to here it works....
var response = AdminReseller.Subscriptions.changeSeats({
customerId: sub.customerId,
subscriptionId: sub.subscriptionId,
numberOfSeats: totalSeats,
});
} 发布于 2016-03-10 13:53:09
我找不到任何关于您的AdminReseller.Subscriptions.changeSeats的引用,但是根据changeSeats API引用,应该只有2个参数需要传递。删除numberOfSeats,因为它应该是请求主体的一部分。您正在使用的命名空间应该能够适应为这种调用添加请求主体的方式。
发布于 2016-03-15 20:00:15
我使用以下代码在我的javascript应用程序上实现了这一点。以下示例是针对年度承诺计划的
var restRequest = gapi.client.request({ 'path':'https://content.googleapis.com/apps/reseller/v1/customers/domainname /订阅/订阅var/更改集‘,body:{ "numberOfSeats":customerdetailskey.totalSeats },'method':'POST’});
发布于 2016-03-15 22:29:56
下面是它在Apps脚本中的工作方式(seats必须是一个对象):
var seats = { numberOfSeats: totalSeats, }
var response = AdminReseller.Subscriptions.changeSeats(seats,sub.customerId,sub.subscriptionId); 谢谢朱利安;)
https://stackoverflow.com/questions/35886131
复制相似问题