Method Web.Api.Google.discover()
- Method
discover
Basediscover(stringapi,stringversion,void|stringclient_id,void|stringclient_secret,void|stringredirect_uri,void|string|array(string)|multiset(string)scope)- Description
Get a Google API object
- Example
This example shows how you can use the Google API to find out all the compute zones that exist at Google Compute Engine.
#define SECRET_FILE "googleserviceaccount.json" #define PROJECT "somegoogleproject" #define TOKENTIME 3600 string jwt_secret = Stdio.File(SECRET_FILE, "r").read(); Web.Api.Google.Base api = Web.Api.Google.discover("compute", "v1"); void authenticated() { if (!api->auth->is_authenticated() || api->auth->expires->unix_time() - time(1) < TOKENTIME / 2) api->auth->get_token_from_jwt(jwt_secret); }; authenticated(); mixed allzones = api->resrc->zones->list( ([ "project":PROJECT ]) );