标签: google-api-client

开发人员如何以编程方式编辑Google文档?是否有Docs API?

似乎没有(据我所知)编辑Google文档的API(不是电子表格,它们基于HTML的文档).有没有人做过类似的事情?也许通过下载HTML版本,编辑和上传更改?

google-api google-docs google-docs-api google-apps-script google-api-client

12
推荐指数
2
解决办法
1万
查看次数

使用GoogleApiClient + LocationServices不更新

我只是想做一个简单的"教程"应用程序来获取我的手机的位置(以便在以后的其他应用程序中学习如何使用它),但我只是没有到达任何地方.

我做了什么

  1. Android Developer的教程:首先,我按照Android开发者网站(developer.android.com/training/location/receive-location-updates.html)中的教程进行操作.

    就像那里所示,我使用了Location,LocationClient和LocationRequest,在onCreate中初始化它们(并设置它们).LocationClient在onStart和onStop上连接和断开连接.

    我在连接后请求位置更新(在onConnected中).我在进行此调用之前验证了GooglePlayServices是否可用,而且我仍然没有在"onLocationChanged"中获得任何更新.

  2. GoogleApiClient:我注意到不推荐使用LocationClient,而首选的是LocationServices(developer.android.com/reference/com/google/android/gms/location/LocationClient.html).

    如下所示:https://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html,我使用GoogleApiClient并将其设置为LocationServices(也是/sf/answers/1750969531/).所以我把它全部设置为使用它,但我仍然没有得到任何关于位置的更新.

onLocationChanged如果有响应则应该打印.我还放了一个打印位置或"没有"的按钮.

备注

我检查了使用谷歌地图,看看我是否有一些东西,但它的工作正常.

项目

的build.gradle

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:5.0.77'
    compile "com.android.support:support-v4:20.0.+"
}
Run Code Online (Sandbox Code Playgroud)

表现

...
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
...
<meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
...
Run Code Online (Sandbox Code Playgroud)

public class MyActivity extends Activity  implements
        GoogleApiClient.ConnectionCallbacks,
        GoogleApiClient.OnConnectionFailedListener,
        LocationListener {

    private GoogleApiClient mLocationClient;
    private Location mCurrentLocation;
    LocationRequest mLocationRequest;

    ...
    /* Constant fields - request interval */
    ...

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);

        mLocationClient …
Run Code Online (Sandbox Code Playgroud)

android location android-location google-api-client google-play-services

12
推荐指数
1
解决办法
2万
查看次数

如何设置公共Google云端存储分区

我正在尝试将文件上传到Google云端存储上的存储桶,但我无法弄清楚如何设置它以使其可公开写入和读取.换句话说,我不想要求用户进行身份验证以便上传到存储桶.有人知道要设置的步骤吗?

我还想知道我需要附加到我的请求标头以便将文件上传到此存储桶.我正在使用iOS API客户端,但如果有人知道原始标头是什么,我可以从中找出如何在iOS中进行操作.目前,我只包括以下额外标题:x-goog-project-id

google-api google-api-client google-cloud-storage google-cloud-platform

12
推荐指数
1
解决办法
4629
查看次数

如何使用其.NET API的v3检索Google Analytics报告数据?

我一直在尝试使用他们提供的.NET api检索谷歌分析报告,并且真的一直在试着如何使用最新版本v3检索任何内容,这可以在这里找到:http://code.google.com /apis/analytics/docs/gdata/v3/gdataLibraries.html

例如,我想检索一个类似这样的报告查询:https://www.google.com/analytics/feeds/data?dimensions = ga:浏览器&end-date = 2012-01-25&ids=ga : ACCOUNTID&metrics= GA:探访&开始日期= 2011-12-25

我能够使用版本2使用GData返回报告,但希望在版本2被弃用的情况下获得版本3,但是看到有意义的文档似乎已经过时或不存在而且很难我找不到任何例子.

.net c# asp.net google-analytics-api google-api-client

11
推荐指数
1
解决办法
1万
查看次数

Google api auth2 signOut无效

首先,我按照本指南https://developers.google.com/identity/sign-in/web/和此参考https://developers.google.com/identity/sign-in/web/reference.

但是我没有声明回调window,而是使用gapi.signin2.render函数来渲染按钮并在我的Angular控制器中为它添加一个处理程序.

登录工作正常,问题是,当我尝试通过调用注销时gapi.auth2.getAuthInstance().signOut(),它只是没有这样做.

我注意到accounts.google.com的sessionStorage仍然存在,因此当我在登录屏幕上再次呈现按钮时,Google会自动重新登录.

我试过看完signOut()完成后会发生什么:

gapi.auth2.getAuthInstance().signOut().then(function() {
    console.log(gapi.auth2.getAuthInstance().isSignedIn.get());
    // prints 'true'
});
Run Code Online (Sandbox Code Playgroud)

我也试过调用disconnect()而不是signOut()知道它会撤销访问权限,它确实从sessionStorage中删除了令牌,但用户会话仍在那里.一旦我重新加载页面,它就消失了.

这是我的完整代码:

$scope.logout = function() {
    //...
    gapi.auth2.getAuthInstance().signOut().then(function() {
      console.log(gapi.auth2.getAuthInstance().isSignedIn);
    });
};

$scope.processAuth = function(authResult) {
  console.log("success");
  if(authResult.getAuthResponse().id_token) {
    // backend calls
  }
};

$scope.renderSignInButton = function() {
  console.log(gapi.auth2);
  gapi.signin2.render('signInButton',
    {
      'onsuccess': $scope.processAuth, // Function handling the callback.
      'onfailure': $scope.signinFailed, // Function handling the callback.
      'clientid': 'asdasdasd.apps.googleusercontent.com',
      'scope': 'https://www.googleapis.com/auth/userinfo.email',
      'cookiepolicy': 'single_host_origin'
    } …
Run Code Online (Sandbox Code Playgroud)

javascript google-api google-api-client angularjs

11
推荐指数
2
解决办法
5771
查看次数

恢复生产系统的已删除(?)Google OAuth客户端应用

我们从Google API获得了401错误:

401. That’s an error.
Error: deleted_client

The OAuth client was deleted.
Run Code Online (Sandbox Code Playgroud)

似乎Google-OAuth-API客户端已被删除.也许在firebase上?当我们删除一个在Google API上也被删除的firebase项目时,真的很奇怪......

有没有办法恢复这个?!

非常感谢你的帮助!

最好

google-api oauth-2.0 google-api-client google-oauth google-oauth2

11
推荐指数
1
解决办法
1万
查看次数

nodejs googleapis,authClient.request不是一个函数

我正在一个函数中创建一个oauth2client,并返回它.我实际上传递了clien id,secret,redirect url和凭据.根据我的检查,这些都是正确的.

var OAuth2 = google.auth.OAuth2;
var oauth2Client = new OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
...
credentials = {
      access_token: accessToken,
      refresh_token: refreshToken
};
oauth2Client.setCredentials(credentials);
Run Code Online (Sandbox Code Playgroud)

然后我在返回oauth2client对象的函数中执行此操作:

var plus = google.plus('v1');
console.log(JSON.stringify(oauth_client));
plus.people.get({ userId: 'me' , auth: oauth_client}, function(err, response) {
    if(err) {
        console.log(err);
    } else {
        console.log(JSON.stringify(response));
        return response;
    }
});
Run Code Online (Sandbox Code Playgroud)

但是,然后我收到一条错误消息,指出authClient.request不是函数.

TypeError:authClient.request不是createAPIRequest中的函数(/node_modules/googleapis/lib/apirequest.js:180:22)

我不确定为什么会出现这个错误.我也做了console.log(JSON.stringify(oauth_client))来检查请求函数,我没有看到任何.有人提到这不能显示完整的原型链,并且请求函数可能实际存在.

google-api node.js google-api-client meteor google-api-nodejs-client

11
推荐指数
1
解决办法
3653
查看次数

Google Drive api范围和文件访问权限(drive vs drive.files)

我为我创建了两个刷新令牌:一个用于

SCOPE = 'https://www.googleapis.com/auth/drive'
Run Code Online (Sandbox Code Playgroud)

和另一个

SCOPE = 'https://www.googleapis.com/auth/drive.file'
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取有关文件的信息(使用get方法)我在使用SCOPE drive.files时可以获得一些文件,有些只在使用更宽范围的驱动器时获得

但我无法弄清楚是什么原因造成的?文件位于不同的文件夹中,但有一个共享的根文件夹.

google-api google-api-client google-drive-api

10
推荐指数
2
解决办法
1万
查看次数

使用Google Drive API更新权限时出现500错误

当我尝试授予任何文件的访问权限时,我收到500错误.当文件与某人共享时,我不想发送电子邮件.我想停止通知电子邮件.

  Insert insert = service.permissions().insert(fileId, newPerm);
  insert.setSendNotificationEmails(false);
  newPerm = insert.execute();


        500 OK
            {
            "code" : 500,
            "errors" : [ {
            "domain" : "global",
            "message" : "Internal Error. User message: \"An internal                                                     error has occurred which prevented the sharing of these item(s): fileame\"",
           "reason" : "internalError"
            } ],
          "message" : "Internal Error. User message: \"An internal error has occurred which prevented the sharing of these item(s): filename\""
            }
Run Code Online (Sandbox Code Playgroud)

感谢任何建议.

google-api google-api-client google-drive-api

10
推荐指数
3
解决办法
2131
查看次数

错误 403:access_denied 尽管正在创建新项目,但开发人员尚未授予您访问此应用的权限

请注意:这不是重复的,因为我通过创建一个新项目来遵循SO only 经过验证的答案,但它没有用。另外我的情况是来自开发控制台的 chrome 扩展或 chrome 应用程序客户端 ID。

错误:

错误 403:access_denied 开发者未授予您访问此应用的权限。它目前正在测试中,尚未得到 Google 的验证。如果您认为您应该拥有访问权限,请联系开发人员

尽管如此,就像我从所有者帐户访问它的另一篇文章一样。同时,我不能对那个帖子的答案发表评论,因为我的声誉不够高。尽管如此,

我正在尝试通过以下方式从用户检索访问令牌:

清单.json:

{
    "manifest_version": 2,
    "name": "To be named",
    "description": "This extension helps...",
    "version": "0.1.0",
    "browser_action":{
        "default_popup":"popup.html"
    },
    "permissions": [
        "storage",
        "identity",
        "identity.email",
        "http://127.0.0.1:5000/Time"
    ],

    "oauth2":{
        "client_id":"10977...esr6.apps.googleusercontent.com",
        "scopes":["https://www.googleapis.com/auth/userinfo.profile"]
    },
    "background": {
        "scripts": ["background.js"],
        "persistent": false
    },  
    "content_scripts": [{
        "matches": ["https://www.blank.org/"], 
        "js": ["content.js"],
        "css": ["styles.css"]
    }]
}
Run Code Online (Sandbox Code Playgroud)

背景.js:

chrome.identity.getAuthToken({ 'interactive': true }, function(token) {
  if (token){alert('token is ' + token)}
  else{alert('token not present')} …
Run Code Online (Sandbox Code Playgroud)

google-api google-chrome-extension google-api-client google-oauth

10
推荐指数
1
解决办法
2万
查看次数