I am new with Google API and I'm trying to connect my web site which is in another google cloud server, running on Django to my Google DataProc Cluster. All but errors until now. Here is my code:
<script src="https://apis.google.com/js/api.js"></script>
<script>
var parameters={
"projectId": "product-994",
"job": {
"placement": {
"clusterName": "cluster-s1"
},
"reference": {
"jobId": "7d77a545-b523-4694-b971-3d17dc0ae4f1"
},
"pysparkJob": {
"mainPythonFileUri": "gs://my-directory/list-tables.py"
}}};
function start() {
gapi.client.init({
'apiKey': 'my_api_key',
'clientId':'myIDohmemne7hanb2d8.apps.googleusercontent.com',
'scope':['https://www.googleapis.com/auth/cloud-platform'],
}).then(function() {
return gapi.client.request({
'path':'https://dataproc.googleapis.com/v1beta2/projects/produc-994/regions/global/jobs:submit/',
'method':'POST',
'body':parameters,
})
}).then(function(response) {
console.log(response.result);
alert(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
gapi.load('client', start);
</script>
But I get this error:
Uncaught TypeError: a.split is not a function
at pZ (https://apis.google.com/_/scs/apps-static/_/js/k=oz.gapi.es.v_tOK2w_1HY.O/m…1/ed=1/am=AQ/rs=AGLTcCM1W2y9cMgCwSVCS8oWU4_pdItscw/cb=gapi.loaded_1:87:396)
Until now I have used: https://developers.google.com/api-client-library/javascript/reference/referencedocs; https://cloud.google.com/dataproc/docs/quickstarts/quickstart-explorer-submit; https://developers.google.com/api-client-library/javascript/start/start-js; https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/web-js?hl=fr. But non of this has worked