Google 人 getBatchGet 中的 resourceNames 是否以逗号分隔?
Is resourceNames comma separated in Google people getBatchGet?
https://developers.google.com/people/api/rest/v1/people/getBatchGet
resourceNames string
The resource names of the people to provide information about.
To get information about the authenticated user, specify people/me. To
get information about a google account, specify people/account_id. To
get information about a contact, specify the resource name that
identifies the contact as returned by people.connections.list. You can
include up to 50 resource names in one request.
指定resourceNames
为字符串,但没有说明是否以逗号分隔,而personFields
是逗号分隔。
官方客户端也是string
类型,所以我猜是逗号分隔?
顺便说一句,我正在使用 Node:https://github.com/google/google-api-nodejs-client/blob/master/src/apis/people/v1.ts#L2399
其类型严格为string
。
当您想使用多个resourceNames
时,请使用以下查询参数。
GET https://people.googleapis.com/v1/people:batchGet?requestMask.includeField=emailAddresses,names&resourceNames=people/me&resourceNames=people/123456789
使用时请按如下编码。
GET https://people.googleapis.com/v1/people:batchGet?requestMask.includeField=emailAddresses%2Cnames&resourceNames=people%2Fme&resourceNames=people%2F123456789
参考
- Method: people.getBatchGet
- apis-explorer
- 你也可以在这里确认端点,当几个
resourceNames
被使用时。
如果我误解了你的问题,我很抱歉。
已添加:
当你想在googleapis中使用它时,请将它作为一维数组使用。
const people = google.people({version: 'v1', auth});
people.people.getBatchGet({
resourceNames: ['people/me', 'people/123456789',,,],
personFields: 'emailAddresses,names',
}, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res.data);
}
});
https://developers.google.com/people/api/rest/v1/people/getBatchGet
resourceNames string
The resource names of the people to provide information about.
To get information about the authenticated user, specify people/me. To get information about a google account, specify people/account_id. To get information about a contact, specify the resource name that identifies the contact as returned by people.connections.list. You can include up to 50 resource names in one request.
指定resourceNames
为字符串,但没有说明是否以逗号分隔,而personFields
是逗号分隔。
官方客户端也是string
类型,所以我猜是逗号分隔?
顺便说一句,我正在使用 Node:https://github.com/google/google-api-nodejs-client/blob/master/src/apis/people/v1.ts#L2399
其类型严格为string
。
当您想使用多个resourceNames
时,请使用以下查询参数。
GET https://people.googleapis.com/v1/people:batchGet?requestMask.includeField=emailAddresses,names&resourceNames=people/me&resourceNames=people/123456789
使用时请按如下编码。
GET https://people.googleapis.com/v1/people:batchGet?requestMask.includeField=emailAddresses%2Cnames&resourceNames=people%2Fme&resourceNames=people%2F123456789
参考
- Method: people.getBatchGet
- apis-explorer
- 你也可以在这里确认端点,当几个
resourceNames
被使用时。
- 你也可以在这里确认端点,当几个
如果我误解了你的问题,我很抱歉。
已添加:
当你想在googleapis中使用它时,请将它作为一维数组使用。
const people = google.people({version: 'v1', auth});
people.people.getBatchGet({
resourceNames: ['people/me', 'people/123456789',,,],
personFields: 'emailAddresses,names',
}, (err, res) => {
if (err) {
console.log(err);
} else {
console.log(res.data);
}
});