Call a DoubleClick Bid Manager API



我正在写我的第一个Google API Winforms应用程序,我无法弄清楚如何使API调用。

这个google"入门"文档中的例子并没有多大帮助。

我有一个客户端ID和秘密,并授权我的应用程序使用这些。

ClientSecrets cs = new ClientSecrets { ClientId = "<...>.apps.googleusercontent.com", ClientSecret = "<...>" };
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(cs, new[] { @"https://www.googleapis.com/auth/doubleclickbidmanager" }, "user", 
            System.Threading.CancellationToken.None, new Google.Apis.Util.Store.FileDataStore(@"C:temp", true));

我现在想调用这个API并查看它的结果。

谁能给我指点一下我该怎么做呢?

安装nuget包Install- package Google.Apis.Doubleclickbidmanager。v1

下面的代码应该适用于Oauth2
string clientId = "ddd";
string clientSecret = "ddd";
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
                                                                                    , scopes
                                                                                    , "test"
                                                                                    , CancellationToken.None
                                                                                    , new FileDataStore(".",true)).Result;
   var service = new DoubleClickBidManagerService(new BaseClientService.Initializer()
       {
       HttpClientInitializer = credential,
       ApplicationName = "xyz",    
       });

你所有的呼叫都应该通过服务

service.Lineitems.Downloadlineitems(body).Execute();

最新更新