API Sandbox

155 views
Skip to first unread message

bhaw...@cfl.rr.com

unread,
Aug 10, 2006, 3:21:53 PM8/10/06
to AdWords API Forum
I Have recently started developing with the Adwords API and am testing
out my code in the sandbox and am having a hard tiem with creating a
campaign. I am using C# and am creating my objects properly. I can
add a campaign to live, but not to the sandbox. here is a sample of my
code:

CampaignServiceService service = new CampaignServiceService();

// set headers
String myUseragent = "xxx";
String myEmail = "xxx";
String myPassword = "xxx";
String myToken = "xxx++USD";

service.useragentValue = new useragent();
service.useragentValue.Text = new String[] { myUseragent };

service.emailValue = new email();
service.emailValue.Text = new String[] { myEmail };

service.passwordValue = new password();
service.passwordValue.Text = new String[] { myPassword };

service.tokenValue = new token();
service.tokenValue.Text = new String[] { myToken };
Campaign campaign = new Campaign();
// retrieve all campaigns and display the data
campaign.dailyBudget = 50000000;
campaign.name = "Testing 12345";
campaign.dailyBudgetSpecified = true;

service.addCampaign(campaign);

I get an internal error and it tells me to retry my request. Any
Ideas? The above code works on Live, but not Sandbox.

david....@gmail.com

unread,
Aug 11, 2006, 7:26:02 AM8/11/06
to AdWords API Forum
i think you have to define the clientEmail
client_1#+login_id

bhaw...@cfl.rr.com schrieb:

bhaw...@cfl.rr.com

unread,
Aug 11, 2006, 8:41:44 AM8/11/06
to AdWords API Forum
That worked, Thank you.

Sean

unread,
Aug 11, 2006, 7:03:12 PM8/11/06
to AdWords API Forum
I'm getting the same error but I have specified the clientEmail. From
what I understand, you just make a call to the given sandbox service
and the sandbox accounts will be created for you. So the first thing I
did was try to make a call using these credentials. The email login
I'm using is a valid google account login that has an actual MCC.
Here's what my code looks like:

//begin code
this.m_ServiceSandbox = new Sandbox.CampaignServiceService();

this.m_ServiceSandbox.useragentValue = new Sandbox.useragent();
this.m_ServiceSandbox.useragentValue.Text = new String[] { "adwords
management" };

this.m_ServiceSandbox.emailValue = new Sandbox.email();
this.m_ServiceSandbox.emailValue.Text = new String[] {
"goo...@login.com" };

this.m_ServiceSandbox.passwordValue = new Sandbox.password();
this.m_ServiceSandbox.passwordValue.Text = new String[] { "password" };

this.m_ServiceSandbox.clientEmailValue = new Sandbox.clientEmail();
this.m_ServiceSandbox.clientEmailValue.Text = new String[] {
"client_...@login.com" };

this.m_ServiceSandbox.tokenValue = new Sandbox.token();
this.m_ServiceSandbox.tokenValue.Text = new String[] {
"goo...@login.com++USD" };
//end code


Any thoughts? I don't need a pound sign in my clientEmail, do I?

Thanks, Sean

Richard Jones

unread,
Aug 12, 2006, 6:43:30 AM8/12/06
to Sean, AdWords API Forum
On Fri, Aug 11, 2006 at 11:03:12PM -0000, Sean wrote:
> Any thoughts? I don't need a pound sign in my clientEmail, do I?

No you don't, but unless you show us the actual XML being sent, it's
pretty much impossible to debug this any further.

Rich.

--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com

que...@gmail.com

unread,
Aug 17, 2006, 9:12:48 AM8/17/06
to AdWords API Forum
I'm having the same problem, using .Net v1.1, VS 2003, C# etc. Here is
the xml that I'm posting along with the response 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"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/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>
<clientEmail
xmlns="https://adwords.google.com/api/adwords/v4">client...@xxxx.com</clientEmail>
<email
xmlns="https://adwords.google.com/api/adwords/v4">xx...@xxxx.com</email>
<password
xmlns="https://adwords.google.com/api/adwords/v4">xxxxxx</password>
<token
xmlns="https://adwords.google.com/api/adwords/v4">xx...@xxxx.com++USD</token>
<useragent xmlns="https://adwords.google.com/api/adwords/v4">Our
Agent CampaignService</useragent>
<wsa:Action>
</wsa:Action>

<wsa:MessageID>uuid:4c40b389-7546-4559-af7a-478d423db0d2</wsa:MessageID>
<wsa:ReplyTo>

<wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>

<wsa:To>https://sandbox.google.com/api/adwords/v4/CampaignService</wsa:To>
<wsse:Security>
<wsu:Timestamp
wsu:Id="Timestamp-ca4a8f76-ec75-43ae-85d7-3021214af388">
<wsu:Created>2006-08-17T12:53:48Z</wsu:Created>
<wsu:Expires>2006-08-17T12:58:48Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<addCampaign xmlns="https://adwords.google.com/api/adwords/v4">
<campaign>
<dailyBudget>5000000</dailyBudget>
<enableSeparateContentBids>false</enableSeparateContentBids>
<geoTargeting xsi:nil="true" />
<id>0</id>
<languageTargeting>
<languages />
</languageTargeting>
<name>Campaign Test</name>
<networkTargeting>
<networkTypes>GoogleSearch</networkTypes>
</networkTargeting>
<status>Active</status>
</campaign>
</addCampaign>
</soap:Body>
</soap:Envelope>

Response:
<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>
<soapenv:Fault>
<faultcode>soapenv:Server.generalException</faultcode>
<faultstring>An internal error has occurred. Please retry your
request.</faultstring>
<detail>
<ns1:code
xmlns:ns1="https://adwords.google.com/api/adwords/v4">0</ns1:code>
<ns2:message
xmlns:ns2="https://adwords.google.com/api/adwords/v4">An internal error
has occurred. Please retry your request.</ns2:message>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

I've tried several different google accounts. I've tried different
clients (client_1+, client_2+, etc.) I get the same error if I don't
include the clientEmail header at all. I've tried updating the
namespaces from adwords.google.com to sandbox.google.com and that
results in a different error stating that there is no email address in
the header, even though there is. The only thing I can think of is
that the accounts I'm using are not MCC accounts in production. I
didn't get the feeling from the breif sandbox doc that it had to be.
Can someone verify if that is the case? Can non-MCC production google
accounts be used in the sandbox?

Will Geith

que...@gmail.com

unread,
Aug 17, 2006, 9:23:40 AM8/17/06
to AdWords API Forum
Actually one of the accounts was an MCC account, so that shouldn't be
the problem. Any help is appreciated.

For others using .Net and wanting to look at the xml that is being sent
and received, take a look at Web Services Enhancements (WSE).
http://msdn.microsoft.com/webservices/webservices/building/wse/

Will Geith

Richard Jones

unread,
Aug 17, 2006, 10:36:02 AM8/17/06
to que...@gmail.com, AdWords API Forum
On Thu, Aug 17, 2006 at 06:12:48AM -0700, que...@gmail.com wrote:
> <wsa:Action>
[...]
> <wsse:Security>

I wonder if these extra wsa and wsse headers are confusing things?

> <languageTargeting>
> <languages />
> </languageTargeting>

This snippet doesn't conform to a strict reading of the WSDL. In any
case you should supply a list of languages, or omit the
<languageTargeting> element completely.

Can you do simple stuff like just listing out campaigns?

que...@gmail.com

unread,
Aug 17, 2006, 11:09:57 AM8/17/06
to AdWords API Forum
I don't think I can get rid of the wsa/wsse headers. Maybe I can look
into it, but I'm not doing anything differently for the sandbox than I
am for production as far as they are concerned.

I tried adding a language target and I still get the same response from
the sandbox.

<languageTargeting>
<languages>en</languages>
</languageTargeting>

I tried adding a geotarget, still fails.

<geoTargeting>
<countries>US</countries>
</geoTargeting>

I tried putting in bad values for the Geotarget and language targeting
(added xxx to the values), and then the error I get bounces between the
standard "Internal Error, please try again" and "The given 'token'
header is invalid." even though I am sending the exact same xml each
time.

que...@gmail.com

unread,
Aug 17, 2006, 11:16:21 AM8/17/06
to AdWords API Forum
I tried listing Campaigns, and I get the same errors. Either "internal
error" or "token header is invalid". I tried pulling usage just for
fun and get the same errors. This worked last week. I made a call to
getUsageQuotaThisMonth and got back a huge number from the sandbox.
Figured it was junk. If I change the token to be something other than
the xx...@xxxx.com++USD then I get the "The given 'token' header is
invalid." error every time.

Will

Patrick Chanezon

unread,
Aug 17, 2006, 12:38:28 PM8/17/06
to que...@gmail.com, AdWords API Forum
I'm sorry about all the issues you encountered.

There is one missing warning in the documentation: the client_1 to 5 subaccounts are created in the sandbox only after your first successful call.
So if you first call contains a clientEmail header it fails.
But after you made a successful first call (for example getting the amount of free quota), the accounts have been created and then you can make calls using clientEmail headers.

I just tried it out and it works fine.
I guess the reason it worked last week was that you had made a first call without this header.
These accounts are cleaned up from the sandbox regularly.

P@
--
Patrick Chanezon, Google API Evangelist
http://blog.chanezon.com/
http://www.google.com/apis/adwords/

Patrick Chanezon

unread,
Aug 17, 2006, 1:03:03 PM8/17/06
to que...@gmail.com, AdWords API Forum
First send a request that works, like getting free quota remaining, with no clientEmail, to make sure that your clientEmail has been created.
Once that is done, I tried your request and got:
  <soapenv:Fault>
     <faultcode>soapenv:Server.userException</faultcode>

     <faultstring>This language code is not valid.</faultstring>

     <detail>

When I replace the languageTargeting by:
         <languageTargeting xsi:nil="true"/>
the call works fine.

If I remember old threads from this list in .net you can trigger the xsi:nil="true" by saying something like
c.languageTargetingSpecified = false;

(sorry I don't have my .net devt envt handy right now)
I hope this helps.

P@

que...@gmail.com

unread,
Aug 17, 2006, 3:18:05 PM8/17/06
to AdWords API Forum
That did it. I made a couple of calls without the clientEmail, and
then I was able to successfully create a campaign.

Thanks guys for looking into this.

Will

Sean

unread,
Aug 24, 2006, 2:29:33 PM8/24/06
to AdWords API Forum
Hey Will,
Just wanted to say thanks for posting the link to the WSE that allows
you to look at and view the xml.

-Sean

Langers

unread,
Sep 10, 2006, 11:09:07 AM9/10/06
to AdWords API Forum
I am having troubles getting these sandbox accounts automatically
generated.

The code I am using is:

com.google.sandbox.InfoService.InfoService service = new
com.google.sandbox.InfoService.InfoService();

// set headers
String myUseragent = "my company";
String myEmail = "lo...@mycompany.co.uk";
String myPassword = "password";
String myToken = "lo...@mycompany.co.uk++GBP";

service.useragentValue = new
com.google.sandbox.InfoService.useragent();


service.useragentValue.Text = new String[] { myUseragent };

service.emailValue = new com.google.sandbox.InfoService.email();


service.emailValue.Text = new String[] { myEmail };

service.passwordValue = new com.google.sandbox.InfoService.password();


service.passwordValue.Text = new String[] { myPassword };

service.tokenValue = new com.google.sandbox.InfoService.token();


service.tokenValue.Text = new String[] { myToken };

long usage = service.getFreeUsageQuotaThisMonth();

Where 'lo...@mycompany.co.uk' is the email I use to login to the MCC
(rather than the client account login).

This code seems to run fine but the sandbox accounts don't get
auto-generated.

Any thoughts?

Richard Jones

unread,
Sep 11, 2006, 6:16:03 AM9/11/06
to Langers, AdWords API Forum
On Sun, Sep 10, 2006 at 08:09:07AM -0700, Langers wrote:
> This code seems to run fine but the sandbox accounts don't get
> auto-generated.

How do you know? Are you trying a particular API call or getting an
error message?

Langers

unread,
Sep 11, 2006, 12:15:40 PM9/11/06
to AdWords API Forum

Hi,

The api call is service.getFreeUsageQuotaThisMonth() in the code I
posted.

There is no error but when I log into my MCC the auto-generated
accounts are not there.

I may be missing the point here though. Are the auto-generated accounts
are not accessible though the MCC?

Peer Jakobsen

unread,
Sep 11, 2006, 12:20:09 PM9/11/06
to AdWords API Forum
Hi,
When you say login, do mean login to the adwords website?
The sandbox data is not available in any website. You can only access
the data by API calls.

Peer Jakobsen

Patrick Chanezon

unread,
Sep 11, 2006, 12:58:46 PM9/11/06
to peer.j...@gmail.com, AdWords API Forum
Yes the idea is that after making one call to InfoService without the clientEmail header, you can start making calls with clientEmail headers because the accounts wopuld have been created.

P@

Langers

unread,
Sep 11, 2006, 1:55:33 PM9/11/06
to AdWords API Forum
ok, thanks guys.

Reply all
Reply to author
Forward
0 new messages