我正在使用以下JS代码来检索我的客户的所有订阅的seats详细信息。
gapi.client.reseller.subscriptions.list()
.then(function(response) {
// Handle the results here (response.result has the parsed body).
console.log("Response", response);
},
function(err) { console.error("Execute error", err); });但是,它也会返回他们的所有其他信息。如何对其进行自定义,使其只返回座位数?
发布于 2021-02-04 20:44:46
Google有一个名为fields的标准参数,允许您选择在响应(see documentation on Docs API)中包含哪些字段。
在Google API Client Library for JavaScript (也称为gapi)中,您可以在发出请求时简单地将参数添加到对象中。在您的情况下,这应该是可行的:
gapi.client.reseller.subscriptions.list({
fields: [
'nextPageToken',
'subscriptions/subscriptionId',
'subscriptions/seats/numberOfSeats',
].join(',')
})保留您需要的所有字段很重要,包括像nextPageToken这样的控制字段。You can read more about the format used here。
https://stackoverflow.com/questions/66044567
复制相似问题