3

DotnetOpenAuth を使用してプロファイル ID を取得し、Google アナリティクス API からデータを取得する方法。

oAuth トークンを取得しましたが、このトークンを使用してデータを取得しようとすると、Exception -- Execution Failed エラーが発生しました。

The request 'Google.Apis.Requests.Request(list @ https://www.googleapis.com/tasks/v1/users/@me/lists?alt=json&prettyPrint=true)' has failed. The service tasks has thrown an exception: Google.GoogleApiRequestException: The remote server returned an error: (401) Unauthorized. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
  at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
  at Google.Apis.Requests.Request.InternalEndExecuteRequest(IAsyncResult asyncResult) in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 327
  --- End of inner exception stack trace ---
  at Google.Apis.Requests.Request.AsyncRequestResult.GetResponse() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 301
  at Google.Apis.Requests.ServiceRequest`1.GetResponse() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 183
  at Google.Apis.Requests.ServiceRequest`1.Fetch() in c:\google\6-21-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 203
  at GoogleAnalyticsNew._Default.FetchTaskslists() in E:\Anagha\GA\GoogleAnalyticsNew\GoogleAnalyticsNew\Default.aspx.cs:line 186

誰でも私を助けてください。

前もって感謝します

4

1 に答える 1

1

次のように、APIキーを使用して情報を要求する必要があります。

GET https://www.googleapis.com/tasks/v1/users/@me/lists/test?key={YOUR_API_KEY}

ここでTasksAPIを試してみることができます。

APIキーがわからない場合は、APIコンソールで見つけることができます。

于 2012-09-20T20:25:19.867 に答える