【发布时间】:2026-02-18 22:55:02
【问题描述】:
我正在尝试将一些事件从移动网站批量流式传输到 BigQuery,并且我正在尝试通过参数触发 Google Cloud Function 来执行此操作。
我已经达到了初始化脚本的目的,但是如何使用参数调用 Google Cloud Function?
<script src="https://apis.google.com/js/api.js"></script>
<script>
function start() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'YOUR_API_KEY',
// Your API key will be automatically added to the Discovery Document URLs.
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start);
</script>
【问题讨论】:
标签: javascript google-cloud-platform google-cloud-functions