Reputation: 5451
I am running my prediction running in CloudML. I want to invoke predict REST API from my NodeJS application and I want to show the prediction result in the NodeJS app running in AppEngine.
I can find the documentation to do it for Python application. But can't find it for NodeJS.
Can I use normal rest client like node-rest-client? If yes how can I pass the Google Application Default Credentials?
Upvotes: 1
Views: 658
Reputation: 1178
Yes you can use the normal node-rest-client, but since the process for Google Application Default Credentials isn't baked into that client you'll have to use https://github.com/googleapis/google-auth-library-nodejs to use Application Default Credentials.
Alternatively you can use the https://github.com/googleapis/google-api-nodejs-client which should support ADC out of the box. You can find the Cloud ML API here:
https://github.com/googleapis/google-api-nodejs-client/blob/master/src/apis/ml/v1.ts
Specifically, you're looking for the "predict" method.
Upvotes: 1