Hi
i just want to know if this is the right way to get the campaigns.. My
client center shows that there are campaigns which confuses me and lead me
to believe that i am doing something wrong here..
i would really appreciate a little insight
thx
shai
Am Donnerstag, 19. Juli 2012 12:13:58 UTC+2 schrieb Shaihulud:
>
> Hi
>
> i am trying to get the campaigns assoziated with my accounts. I dived
> throuh the example classes and build this little bit of code
>
> [code]
>
> ...
>
> ServicedAccountServiceInterface servicedAccountService = null;
> // Get the ServicedAccountService.
> try {
> servicedAccountService = new AdWordsServices().get(session,
> ServicedAccountServiceInterface.class);
> } catch (ReflectionsException e) {
> }
>
> // Create selector.
> ServicedAccountSelector selector = new ServicedAccountSelector();
> // To get the links paging must be disabled.
> selector.setEnablePaging(false);
>
> // Get serviced account graph.
> ServicedAccountGraph graph = servicedAccountService.get(selector);
>
> // Display serviced account graph.
> if (graph != null) {
> // Create account tree nodes for each account.
> for (Account account : graph.getAccounts()) {
> CampaignServiceInterface campaignServiceInterface = null;
> try {
> campaignServiceInterface = new
> AdWordsServices().get(session, CampaignServiceInterface.class);
> } catch (ReflectionsException e) {
> }
>
> int offset = 0;
>
> // Create selector.
> Selector selector2 = new Selector();
> selector2.setFields(new String[] {"Id", "Name"});
> selector2.setOrdering(new OrderBy[] {new OrderBy("Name",
> SortOrder.ASCENDING)});
> selector2.setPaging(new Paging(offset, PAGE_SIZE));
>
> CampaignPage page = null;
> System.out.println("**CAMPAIGNS**");
> do {
> // Get all campaigns.
> page = campaignServiceInterface.get(selector2);
>
> // Display campaigns.
> if (page.getEntries() != null) {
> for (Campaign campaign : page.getEntries()) {
>
> [/code]
>
> Now i have 2 question because it seems im on the wrongt track here. I
> would like to get the campaigns specific to an account and not all of them.
> How can i do that.
>
> Also, campaignpage returns null for the entries (Campaign[]), which is
> weird because there should be several campaigns for eacht of the clients
> (assuming that each account represents a client !? ).
>
> I would apreciate any help. Isnt there any example code that shows the
> basic operation of getting all infos to a client? campaigns, assoziated,
> adgroups, associated adtext, assoziated keywords etc?
> thx for the help
> shai
>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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