我正在尝试访问contacts.readonly范围,同时在Google Developers Console中的项目API中启用了Contacts API.
$ export client_id='**********************************************.apps.googleusercontent.com'
$ export scope='https://www.googleapis.com/auth/contacts.readonly'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/contacts.readonly]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
Run Code Online (Sandbox Code Playgroud)
当我将范围更改为读写时,这有效:
$ export scope='https://www.google.com/m8/feeds'
$ curl -d "client_id=${client_id}&scope=${scope}" https://accounts.google.com/o/oauth2/device/code
{
"device_code" : "*********************************************",
"user_code" : "********",
"verification_url" : "https://www.google.com/device",
"expires_in" : 1800,
"interval" : 5
}
Run Code Online (Sandbox Code Playgroud)
在控制台中添加Google+ API也无济于事.
我想知道如何让所有联系人都与一个群组相关.假设我有一个名为"My Special Group"的联系人组,ID为xxxxxxx.我只想检索"My Special Group"下的联系人.
我已经尝试过这个Request URI并在oauth2 playground上测试它:
https://www.google.com/m8/feeds/contacts/default/full/?group=xxxxxxx.https://www.google.com/m8/feeds/contacts/myemail%40gmail.com/full/?group=xxxxxxx.结果是:
<errors xmlns="http://schemas.google.com/g/2005">
<error>
<domain>GData</domain>
<code>invalid</code>
<internalReason>Supposed groupUri xxxxxxxxdoes not match template</internalReason>
</error>
</errors>
Run Code Online (Sandbox Code Playgroud)
检索与特定组相关的联系人的正确Request URI究竟是什么?
已经走过stackoverflow并且答案正是我上面做的.它失败了.
我在PHP应用程序中使用Google URL Shortener API。它已经工作了几个月,但现在却出现此错误:
[errors] => Array (
[0] => stdClass Object (
[domain] => usageLimits
[reason] => dailyLimitExceededUnreg
[message] => Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.
[extendedHelp] => https://code.google.com/apis/console
)
)
[code] => 403
[message] => Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.
Run Code Online (Sandbox Code Playgroud)
我正在使用开发人员控制台中的服务器密钥,我重新生成了密钥,甚至删除了服务器访问密钥部分并重新添加了它,但是我仍然收到相同的身份验证错误。
$query_array = json_encode( array( "longUrl" => $data['long_url'], 'key' => 'AIza-Key' ) );
$curl = curl_init( 'https://www.googleapis.com/urlshortener/v1/url' );
curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' ) );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, …Run Code Online (Sandbox Code Playgroud) 我应该遵循什么规则来设置文件的自定义ID?我尝试了简短的“ 12345”,“ abcde”,44个字符的字母数字字符串,UUID.randomUUID()。toString()(带/不带破折号)-所有尝试均返回“提供的文件ID不可用”。我找不到任何记录的要求。代码:
Drive drive = new Drive.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), credentials).build();
FileContent mediaContent = new FileContent("image/png", tempFile);
File body = new File();
body.setId(...);
body.setTitle(...);
body.setMimeType("image/png");
File result = drive.files().insert(body, mediaContent).execute();
Run Code Online (Sandbox Code Playgroud)
响应:
400 Bad Request
{
"code": 400,
"errors":
[{
"domain": "global",
"location": "file.id",
"locationType": "other",
"message": "The provided file ID is not usable",
"reason": "invalid"
}],
"message": "The provided file ID is not usable"
}
Run Code Online (Sandbox Code Playgroud)
当我不尝试设置ID 时,相同的代码会将我的文件正确上传到云端硬盘。
我已经通过composer安装了Google PHP API客户端库; https://github.com/google/google-api-php-client
guzzle,psr,monolog,firebase和google目录现已在我的供应商目录中创建.
但是,我很难将其添加为我的控制器中的依赖项.
大多数答案表明你需要创建一个Cake插件才能在核心中使用新的库,但我很难找到解释如何执行此操作的任何资源.
在不属于蛋糕核心的控制器中使用新库的正确方法是什么?
我尝试在成功 OAuth2 之后尝试实现People API,当尝试加载人员时,错误是:
Undefined property: Google_Service_People_Resource_People::$connections
Run Code Online (Sandbox Code Playgroud)
这是产生错误的行:
$people_service = new Google_Service_People($client);
$connections = $people_service->people->connections->listConnections('people/me');
Run Code Online (Sandbox Code Playgroud)
我将通过本教程https://developers.google.com/people/v1/getting-started,以及:https://developers.google.com/people/v1/requests.
谢谢
我一直在尝试实现一个基本的iOS应用程序,该应用程序会在事件发生时写入Google电子表格.我在这里开始使用Google开发人员文档:https://developers.google.com/sheets/quickstart/ios,并且能够在添加数据和更新数据之前完成工作.但是,我无法找到附加数据的方法(插入新行).
我已经使用[self.service fetchObjectByUpdatingObject:...方法来完成上述[self.service fetchObjectByInsertingObject:...方法,但方法拒绝在同一行上工作.
参考文档讨论了一个append用于此目的的方法,但我找不到在iOS中调用它的方法.我已经尝试了几乎所有在GTLService课堂上提供给我们的Fetch Methods .
更新:我正在寻找iOS对应程序来执行Java中的以下操作:service.spreadsheets().values().append
有关如何将数据附加到电子表格的任何指导都非常感谢.
PS:我也尝试过标准的REST方法但总是返回Unauthenticated错误.所以,我放弃了,并采取了上述方法,其中包括添加,更新.如果有人需要我发布添加,更新实施的代码,请告诉我.
我可以通过以下引用使用API从Google Drive获取文件:在ASP.Net中使用C#和VB.Net在Google Drive中使用Google Drive API显示(查看)文件列表。
但是我只得到100条记录。我有成千上万的记录。任何人都可以让我知道要更改以获取完整记录显示的内容。
请在下面找到代码:
namespace GoogleDrive
{
public partial class gDrive : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GoogleConnect.ClientId = "942196220502-k107l4mtn6n606d8m38pp2k6clfmbftd.apps.googleusercontent.com";
GoogleConnect.ClientSecret = "oJxTZ2Bw9QfOlrc7KgxsEf9o";
GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0];
GoogleConnect.API = EnumAPI.Drive;
if (!string.IsNullOrEmpty(Request.QueryString["code"]))
{
string code = Request.QueryString["code"];
string json = GoogleConnect.Fetch("me", code);
GoogleDriveFiles files = new JavaScriptSerializer().Deserialize<GoogleDriveFiles>(json);
gv1.DataSource = files.Items.Where(i => i.Labels.Trashed == false);
gv1.DataBind();
}
else if (Request.QueryString["error"] == "access_denied")
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Access denied.')", true);
}
else
{
GoogleConnect.Authorize("https://www.googleapis.com/auth/drive.readonly");
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Google Cloud Print(GCP)API,但无法使其正常运行。也许我对工作流程的理解不正确,因为这是我第一次使用Google API,请帮助我了解如何使其工作。
初步考虑:
我到底想要什么:
为了进行首次测试,我希望获得有关打印机的所有信息。
我做了什么:
我选择了“应用程序类型:Web”,还配置了对源和重定向到本地主机的限制。
我在https://www.google.com/cloudprint中手动添加了打印机,并进行了打印PDF的测试,一切正常。
我在reactJS中创建了一个项目,以获取我添加的打印机的信息。
零件:
说明:
我正在使用一个组件react-google-login来轻松获取用户accessToken:https : //github.com/anthonyjgrove/react-google-login
该组件仅获取访问令牌并将其保存在localStorage中的变量中googleToken,它绘制一个按钮以调用函数以获取有关打印机的信息。
码:
import React, { Component } from 'react'
import GoogleLogin from 'react-google-login';
import { connect } from 'react-redux'
import { getPrinters } from '../actions/settings'
class Setting extends Component {
responseGoogle(response) {
const accessToken = response.accessToken
localStorage.setItem('googleToken', accessToken)
}
render() {
return (
<div>
<GoogleLogin
clientId="CLIENT_ID_REMOVED_INTENTIONALLY.apps.googleusercontent.com"
buttonText="Login"
onSuccess={this.responseGoogle}
onFailure={this.responseGoogle} …Run Code Online (Sandbox Code Playgroud) 我正在尝试获得一个基于RaspberryPi3 Python的鸟舍,以阅读其自己上传的视频的受欢迎程度(这使它能够推断出应该删除的视频,并避免数百个上传的文件)。我认为阅读#views /#likes的最好方法是使用yt_analytics_report.py
当我输入时,它总是返回0值:
当我输入:
$python yt_analytics_report.py --filters="video==bb_o--nP1mg"
Run Code Online (Sandbox Code Playgroud)
要么
$python yt_analytics_report.py --filters="channel==UCGXIq7h2UeFh9RhsSEsFsiA"
Run Code Online (Sandbox Code Playgroud)
输出为:
$ python yt_analytics_report.py --filters =“ video == bb_o--nP1mg” {'metrics':'views,estimatedMinutesWatched,averageViewDuration','filters':'video == bb_o--nP1mg','ids:' channel == MINE','end_date':'2018-01-12','start_date':'2018-01-06'}
请访问此URL以授权此应用程序:[注意:此处是带有其他序列的url等。结果]:
观看次数估计数MinutesWatched averageViewDuration 0.0 0.0 0.0
我是新来的;最近3天,我一直在测试各种过滤器,但结果始终相同。我想我做错了严重的事情。(自动传感器触发的)视频上传效果非常好,因此我认为根本原因与我使用yt-analytics示例的方式有关。如有任何关于rootcause的建议或替代方法,以检索自己上传的youtube的#views /#likes。
python google-api youtube-api youtube-data-api raspberry-pi3
google-api ×10
php ×3
.net ×1
android ×1
api ×1
asp.net ×1
c# ×1
cakephp ×1
cakephp-3.0 ×1
curl ×1
google-oauth ×1
google-plus ×1
ios ×1
python ×1
reactjs ×1
youtube-api ×1