AdWords API : client list for non MCC account - c#

I want to get a list of AdWords clients assigned to authenticated account (i use OAuth).
First attempt was to use ServicedAccountService and this XML request
<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/mcm/v201109">
<developerToken xmlns="https://adwords.google.com/api/adwords/mcm/v201109">[[DEV_TOKEN]]</developerToken>
</RequestHeader>
</soap:Header>
<soap:Body>
<get xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
<selector>
<enablePaging>false</enablePaging>
</selector>
</get>
</soap:Body>
</soap:Envelope>
But it works only for MCC accounts. For regular google account i got empty dataset
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/mcm/v201109">
<ns2:requestId>0004bc71cee633d00aecb0aa000060ca</ns2:requestId>
<ns2:serviceName>ServicedAccountService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>0</ns2:operations>
<ns2:responseTime>230</ns2:responseTime>
<ns2:units>0</ns2:units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<getResponse xmlns="https://adwords.google.com/api/adwords/mcm/v201109" xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109">
<rval>
<accounts>
<customerId>0</customerId>
<canManageClients>false</canManageClients>
</accounts>
</rval>
</getResponse>
</soap:Body>
</soap:Envelope>
I googled a lot, and finally found that i can use other XML (InfoService) for both MCC and non MCC accounts.
<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/info/v201109">
<developerToken xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[DEV_TOKEN]]</developerToken>
</RequestHeader>
</soap:Header>
<soap:Body>
<get xmlns="https://adwords.google.com/api/adwords/info/v201109">
<selector>
<dateRange>
<min xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[START_DATE]]</min>
<max xmlns="https://adwords.google.com/api/adwords/cm/v201109">[[END_DATE]]</max>
</dateRange>
<includeSubAccounts>true</includeSubAccounts>
<apiUsageType>UNIT_COUNT_FOR_CLIENTS</apiUsageType>
</selector>
</get>
</soap:Body>
</soap:Envelope>
But data returned is incorrect - not all accounts are listed. Or no data returned at all.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
<ns2:requestId>0004bc7121a910e80a97030d000051e7</ns2:requestId>
<ns2:serviceName>InfoService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>1206</ns2:responseTime>
<ns2:units>1</ns2:units>
</ResponseHeader>
</soap:Header>
<soap:Body>
<getResponse xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201109" xmlns="https://adwords.google.com/api/adwords/info/v201109">
<rval>
<cost>0</cost>
</rval>
</getResponse>
</soap:Body>
</soap:Envelope>
Is there any other way to get client list for AdWords account? Thanks a lot.

I've also encountered this problem, and can confirm that it's not the correct behaviour of the ServicedAccountService; it's a "known issue that will be resolved in future": If you link your basic account to an MCC, then you can authenticate with the basic account and use the ServicedAccountService to obtain the account details, but if the account isn't linked then you'll get this problem.
If you just want to obtain the customer id for an account, you can also use the InfoService, which doesn't suffer from the same issue.

Related

c# send SOAP request with headers

I need to send an custom header mentioned below and get response from the proxy client. could some please share some basic sample code to achive the same.
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ses="http://xml.amadeus.com/2010/06/Session_v3">
<soap:Header>
<add:MessageID xmlns:add="http://www.w3.org/2005/08/addressing">0685482c-7f32-46b6-b27f-3149935b9307</add:MessageID>
<add:Action xmlns:add="http://www.w3.org/2005/08/addressing">http://webservices.amadeus.com/Hotel_MultiSingleAvailability_10.0</add:Action>
<add:To xmlns:add="http://www.w3.org/2005/08/addressing">https://noded5.test.webservices.amadeus.com/1ASIWPOC1A</add:To>
<link:TransactionFlowLink xmlns:link="http://wsdl.amadeus.com/2010/06/ws/Link_v1" />
<oas:Security xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<oas:UsernameToken xmlns:oas1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" oas1:Id="UsernameToken-1">
<oas:Username></oas:Username>
<oas:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">RjJmUSsjczI=</oas:Nonce>
<oas:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">ZmJhZTdhY2E0YzdkYjIyODFkNDY2Y2RjZDYxN2MyZDlkYTE5NWJkYg==</oas:Password>
<oas1:Created>2022-09-08T18:27:59.86Z</oas1:Created>
</oas:UsernameToken>
</oas:Security>
<AMA_SecurityHostedUser xmlns="http://xml.amadeus.com/2010/06/Security_v1">
<UserID AgentDutyCode="SU" POS_Type="1" PseudoCityCode="" RequestorType="U" />
</AMA_SecurityHostedUser>
</soap:Header>
</soap:Envelope>

How can i get the sharedmailbox mails from EWS api?

I am able to get the sharedmailbox mail by this C# code but I want api for the same .Is EWS server provide so .
FolderId SharedMailbox = new FolderId(WellKnownFolderName.Inbox,"Shared#domain.com");
ItemView itemView = new ItemView(1000);
service.FindItems(SharedMailbox,itemView);
I see there is something which give me my mailbox details
https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/findconversation-operation
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP1" />
</soap:Header>
<soap:Body>
<m:FindConversation>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="1" Offset="0"/>
<m:ParentFolderId>
<t:DistinguishedFolderId Id ="inbox"/>
</m:ParentFolderId>
</m:FindConversation>
</soap:Body>
</soap:Envelope>
I want same like for my shared mailbox mails.
Is there is any api same like this for shared mailbox mail?
You can use this. You can mention shared mailbox like this.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013" />
</soap:Header>
<soap:Body>
<m:FindConversation>
<m:IndexedPageItemView MaxEntriesReturned="1" Offset="0" BasePoint="End" />
<m:ParentFolderId>
<t:DistinguishedFolderId Id="inbox" >
<t:Mailbox>
<t:EmailAddress>sharedmail#mail.com</t:EmailAddress>
</t:Mailbox>
</t:DistinguishedFolderId>
</m:ParentFolderId>
</m:FindConversation>
</soap:Body>
</soap:Envelope>

Exchange Soap Update notes contact?

I was unable to execute a Soap Exhange request to update contacts:PersonalNotes .
I have not found documentation on msdn: https://msdn.microsoft.com/en-us/library/office/ee693002(v=exchg.80).aspx
this is my soap code:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
<t:TimeZoneContext>
<t:TimeZoneDefinition Id="Eastern Standard Time" />
</t:TimeZoneContext>
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly"
ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId
Id="AAMkAD...QAAAz9hI5AAA=" ChangeKey="EQAAAB...QAAAz9rdN" />
<t:Updates>
<t:SetItemField>
<t:FieldURI FieldURI="contacts:Notes" />
<t:Contact>
<t:Notes>TEST N</t:Notes>
</t:Contact>
</t:SetItemField>
</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>
this the error displayed:
What is the soap code to write to edit the Contact PersonalNotes ?
The Notes field in a Contact is the Body Property of a Message so to update you need to update the body eg
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<t:RequestServerVersion Version="Exchange2013_SP1" />
</soap:Header>
<soap:Body>
<m:UpdateItem MessageDisposition="SaveOnly" ConflictResolution="AlwaysOverwrite">
<m:ItemChanges>
<t:ItemChange>
<t:ItemId Id="AAMkADczN=" ChangeKey="EQAAABYAAAB1EEf9R" />
<t:Updates>
<t:SetItemField>
<t:FieldURI FieldURI="item:Body" />
<t:Contact>
<t:Body BodyType="Text">test text</t:Body>
</t:Contact>
</t:SetItemField>
</t:Updates>
</t:ItemChange>
</m:ItemChanges>
</m:UpdateItem>
</soap:Body>
</soap:Envelope>

Request is not created

I have created a wcf client that makes a request to get the data.
When i made a call to service, the request itself not created.
I am sending all the header information to the service and it is not sending a request.
The request is using SOAP,
<?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"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext- 1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<VisSvcHeaders xmlns="http://dai.es.VisSvc/2010/svc">
<packNGo>false</packNGo>
</VisSvcHeaders>
<wsa:Action>http://vissvc.esi.daimler.com/2010/svc/getData</wsa:Action>
<wsa:From>
<wsa:Address>Vis</wsa:Address>
</wsa:From>
<wsa:MessageID>urn:uuid:795b9745-4867-4f05-af5a- 87704920a6dd</wsa:MessageID>
<wsa:ReplyTo>
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
<wsa:To>https://vissvc.e.corpintra.net/VisSvcNative/DAIESIVisService</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-6bf652ad-6f2e-4312-ae4f-5807c5f21e38">
<wsu:Created>2014-02-19T08:41:48Z</wsu:Created>
<wsu:Expires>2014-02-19T08:46:48Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<getData xmlns="http://dai.esi.VisSvc/2010/svc">
<part xmlns="">
<number xmlns="http://dai.es.VisSvc/2010/bo">43</number>
<referenceConfiguration xmlns="http://dai.esi.VisSvc/2010/bo">
<lifecycle xmlns="">Rel</lifecycle>
</referenceConfiguration>
<mode xmlns="http://dai.es.VisSvc/2010/bo">open</mode>
</part>
</getData>
</soap:Body>
How can I send the request as this, and the code I am using is,
ServiceReference2.ServicePortTypeClient svc = new ServiceReference2.ServicePortTypeClient();
WebRequest request = WebRequest.Create("http://vissvc- test.e.intra.net/SvcNative/VisService");
ServiceReference2.PartType part = new ServiceReference2.PartType();
part.number = "43";
ServiceReference2.ResponseType res = svc.getData(part);
Console.WriteLine(res);
This request of getData() is not sending or creating a request of this sort.
I am using .net c# 4.0.

SOAP fault message

I have to send a SOAP fault message over HTTP to another web service if something goes wrong with a server, so I have this code:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Response status="1">
<Description>DESC</Description>
<Errors>
<Error>500</Error>
</Errors>
</Response>
</soapenv:Body>
</soapenv:Envelope>
Is this a properly formatted SOAP fault message?
Is this a properly formatted SOAP fault message?
No it isn't. It should look something like this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>...</faultcode>
<faultstring>...</faultstring>
<detail>...</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The SOAP specification specifies what a fault is. Yours looks like an error result object of some sort which has some disadvantages as explained here for example.
Your WS framework should properly generate faults if you throw exceptions. If you are not using a framework but building the fault in some other way, then it must look like in my example above or it can't be called a SOAP fault.
Hey Bogdan I wrote this code and works like a charm!
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>500</faultcode>
<faultstring>SERVER ERROR</faultstring>
<detail>
<Response_status>1</Response_status>
<Description>DESCRIPTION</Description>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
But another question how to send a SOAP success message with a http code 200 an also I have to have some additional parameters in the message, this is a part of it
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Response_status>0</Response_status>
<Description>SUCCESS</Description>
</soap:Body>
</soap:Envelope>
So with this also I have to send code 200, how to write that can I write it like this
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<soap:Fault>
<faultcode>200</faultcode>
<faultstring>OK</faultstring>
<detail>
<Response_status>0</Response_status>
<Description>SUCCESS</Description>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

Categories

Resources