Hi Ibrahim,
Could you kindly download the latest library
from http://code.google.com/p/google-api-adwords-dotnet/downloads/list and
try? You need to copy the App.config from the examples folder to your
App.config and fill the credentials in it. There are lots of code examples
under
http://code.google.com/p/google-api-adwords-dotnet/source/browse/#svn%2Ftrunk%2Fexamples%2Fadwords%2Fcsharp.
Let me know if you get stuck and I'll help you out.
Cheers,
Anash P. Oommen,
AdWords API Advisor.
On Friday, 31 August 2012 17:36:57 UTC+5:30, Ibrahim Ozturkcan wrote:
>
> I have found lots of websites advising about Adwords API and best
> practices,
> *But there's no one page example of how to use Adwords API in the world.*
>
> I don't understand Why it has to be so difficult and non-friendly.
>
> Adwords API documents are terrible.
> Adwords API, .NET client is not working properly.
>
> - .sln file is not working, just not working.
> - Adwords & Common libraries have always yellow exclamation,
> - .proj files are not working, they're not including references,
> - there's no document to start from scratch for just get a metric of
> any report.
>
> Adwords API is just terrible.
>
> On Friday, June 29, 2012 1:11:03 PM UTC+3, Anash P. Oommen wrote:
>>
>> Hi,
>>
>> Please extract the response for the failed request and post it on this
>> forum. You could do it in the catch() block.
>>
>> WebResponse response = ex.Response;
>> // Read the contents from response.GetResponseStream();
>>
>> Also, is there any reason why you are not using the AdWords API .NET
>> client library?
>>
>> Cheers,
>> Anash P. Oommen,
>> AdWords API Advisor.
>>
>> On Thursday, 28 June 2012 18:32:29 UTC+5:30, Ibrahim Ozturkcan wrote:
>>>
>>> private static void GetReports()
>>> {
>>> string authToken = GetAuthToken();
>>> string requestXml = string.Format(@"
>>>
>>> <?xml version='1.0' encoding='utf-8'?>
>>>
>>> <soap:Envelope xmlns:soap='
>>> http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='
>>> http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='
>>> http://www.w3.org/2001/XMLSchema'>
>>>
>>> <soap:Header>
>>> <RequestHeader xmlns='
>>> https://adwords.google.com/api/adwords/cm/v201109_1/AdGroupService'>
>>>
>>> <authToken>{0}</authToken>
>>> <clientCustomerId>{1}</clientCustomerId>
>>>
>>> <developerToken>{2}</developerToken>
>>>
>>> <userAgent>{3}</userAgent>
>>> </RequestHeader>
>>> </soap:Header>
>>>
>>> <soap:Body>
>>>
>>> <get xmlns='
>>> https://adwords.google.com/api/adwords/cm/v201109_1/AdGroupService'>
>>> <serviceSelector>
>>> <fields>id</fields>
>>> <fields>url</fields>
>>> <fields>approvalStatus</fields>
>>> </serviceSelector>
>>> </get>
>>>
>>> </soap:Body>
>>>
>>> </soap:Envelope>",
>>> authToken, "ID", "AUTHTOKEN", "AGENT").Trim();
>>>
>>> WebRequest webRequest = HttpWebRequest.Create("
>>> https://adwords.google.com/api/adwords/cm/v201109_1/AdGroupService");
>>>
>>> //AdGroupCriterionService
>>>
>>> webRequest.Method = "POST";
>>> webRequest.ContentType = "text/xml; charset=utf-8";
>>> webRequest.Headers.Add("SOAPAction", "");
>>> byte[] postBytes = Encoding.UTF8.GetBytes(requestXml);
>>> webRequest.ContentLength = postBytes.Length;
>>>
>>> using (Stream strmReq = webRequest.GetRequestStream())
>>> {
>>> strmReq.Write(postBytes, 0, postBytes.Length);
>>> }
>>> try
>>> {
>>> WebResponse response = webRequest.GetResponse();
>>>
>>> using (StreamReader reader = new
>>> StreamReader(response.GetResponseStream()))
>>> {
>>> string responseXml = reader.ReadToEnd();
>>> XmlDocument xDoc = new XmlDocument();
>>> xDoc.LoadXml(responseXml);
>>> XmlNamespaceManager xmlns = new
>>> XmlNamespaceManager(xDoc.NameTable);
>>> xmlns.AddNamespace("soap", "
>>> http://schemas.xmlsoap.org/soap/envelope/");
>>> xmlns.AddNamespace("v201109_1", "
>>> https://adwords.google.com/api/adwords/cm/v201109_1");
>>> XmlElement faultNode = (XmlElement)
>>> xDoc.SelectSingleNode("soap:Envelope/soap:Body/soap:Fault", xmlns);
>>>
>>> if (faultNode != null)
>>> {
>>> // Something went wrong with API call. Parse
>>> faultNode for more details.
>>> } else
>>> {
>>> XmlElement mutateResponseNode = (XmlElement)
>>> xDoc.SelectSingleNode("soap:Envelope/soap:Body/v201109:mutateResponse",
>>> xmlns);
>>> // Parse mutateResponseNode contents to get the
>>> campaign id.
>>> }
>>> }
>>> }
>>> catch (WebException ex)
>>> {
>>> throw new ApplicationException("Could not make Api
>>> call.", ex);
>>> }
>>> }
>>>
>>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en