-
Notifications
You must be signed in to change notification settings - Fork 0
AdWords API Client library provides several configuration settings that you can use to customize the library behaviour. You may configure the library beforehand using your application's App.config / Web.config, or delay the configuration until runtime. The following article explains the settings as they appear in the App.config. If you don't want to use the App.config, you can do the same configuration at runtime as follows:
AdWordsUser user = new AdWordsUser();
AdWordsAppConfig config = (AdWordsAppConfig) user.Config;
config.DeveloperToken = "xxx";
The settings that are specific to AdWords API client library are stored under the "AdWordsApi" settings node. The various supported keys and their purpose are given below:
You can use the following settings to control the logging behaviour of the client library.
- LogPath: The folder to which SOAP and HTTP messages are logged if {{{LogToFile = true}}}.
- {{{LogToConsole}}}: Set this key to true if you want SOAP and HTTP logs to be written to {{{stdout}}}. Useful for debugging purposes.
- {{{LogToFile}}}: Set this value to true if you want to log SOAP and HTTP messages into log files.
- {{{MaskCredentials}}}: Set this value to true to mask the {{{authToken}}} and {{{developerToken}}} in log files. This is useful when you want to post logs to a public forum and don't want others to see your credentials. We need only the SOAP xmls and the account id to troubleshoot an issue.
- {{{LogErrorsOnly}}}: Use this key to turn on SOAP and HTTP logging, but only if a request fails. This is useful if you want to turn on logging on the server to troubleshoot an elusive issue.
== General library behaviour ==
These settings are common to client libraries, and not tied to an API version.
- {{{RetryCount}}}: Use this key to automatically retry a call that failed due to a recoverable error like expired credentials or a transient error like {{{RateExceededError}}}.
- {{{Timeout}}}: Use this key to set service timeout in milliseconds. Set this to -1 if you never want the service to timeout. See http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout.aspx for details.
- {{{ProxyServer}}}: Set this to the http proxy server url if you are using a proxy to connect to the internet.
- {{{ProxyUser}}}: Set this to the username you require to authenticate against the proxy server. Leave this empty if a username is not required.
- {{{ProxyPassword}}}: Set this to the password of ProxyUser if you set a value for ProxyUser.
- {{{ProxyDomain}}}: Set this to the domain for ProxyUser if your proxy server requires one to be set.
- {{{EnableGzipCompression}}}: Set this to true to use HTTP compression while talking to the Adwords server.
== AdWords API configuration ==
These settings are specific to AdWords API.
- {{{UserAgent}}}: Set this to a string of your choice, ideally your company name, application name or any other unique string.
- {{{DeveloperToken}}}: Set this to your developer token.
- {{{ClientCustomerId}}}: Set this to the customer id of your client account.
== OAuth2 as Authorization method ==
These settings apply when using OAuth2 API as authorization method for AdWords API. See https://developers.google.com/accounts/docs/OAuth2 for details.
- {{{AuthorizationMethod}}}: This should be set to {{{OAuth2}}}.
- {{{OAuth2Mode}}}: This should be set to {{{APPLICATION}}} or {{{SERVICE_ACCOUNT}}}
- {{{OAuth2ClientId}}}: Set this value to your OAuth2 client id.
- {{{OAuth2ClientSecret}}}: Set this value to your OAuth2 client secret.
- {{{OAuth2Scope}}}: Set this value to different scope if you want to authorize OAuth2 tokens for APIs other than AdWords API. This setting is optional.
If you are using {{{OAuth2Mode == APPLICATION}}}, then you need to set the following additional configuration keys.
- {{{OAuth2RefreshToken}}}: Set this value to a pre-generated OAuth2 refresh token if you wish to reuse OAuth2 tokens. This setting is optional.
- {{{OAuth2RedirectUri}}}: Set this value to the OAuth2 redirect url. This setting is optional.
If you are using {{{OAuth2Mode == SERVICE_ACCOUNT}}}, then you need to set the following additional configuration keys.
- {{{OAuth2ServiceAccountEmail}}}: Set this value to the service account email being used to make calls.
- {{{OAuth2PrnEmail}}}: Set this value to the login email of the account you are impersonating.
- {{{OAuth2JwtCertificatePath}}}: Set this value to the OAuth2 JWT certficate path.
- {{{OAuth2JwtCertificatePassword}}}: Set this value to the OAuth2 JWT certificate password.
== ClientLogin as Authorization method ==
These settings apply when using ClientLogin API as authorization method for AdWords API. See https://developers.google.com/accounts/docs/AuthForInstalledApps for details.
Note: ClientLogin API is deprecated and its use as an authorization method is discouraged. You should switch to OAuth2 at the earliest.
- {{{AuthorizationMethod}}}: Set the Authorization method to be used with the client library. Acceptable values are ClientLogin and and OAuth2.
- {{{Email}}}: Set this to your Adwords API login email.
- {{{Password}}}: Set this to your Adwords API login password.
- {{{AuthToken}}}: This key allows you to reuse an auth token. See http://adwordsapi.blogspot.com/2010/07/discover-v2009-working-with-authtokens.html for more details.
== Miscellaneous settings ==
The AdWords API .NET client library uses SOAP extensions to implement certain features like HTTP and SOAP logging, API units logging, etc. You can enable these features by adding the following nodes in your App.config.
{{{ <system.web> </system.web> }}}
The AdWords API .NET client library uses TRACE to print various warnings and debug messages. You can configure this behaviour using the following node in App.config
{{{ <system.diagnostics>
The .NET runtime trims the error response to 64K by default. To disable this setting, you need to add the following node to your App.config.
{{{ <system.net> </system.net> }}}