Hi,

When i change the status of the keyword in the adwords UI, and then
use the v13 api  to get the keyword object, the status change is not
reflected in the object.
    Also if i change the status of the keyword using keyword.setStatus
() using the adwords v13 api, no exception is returned, however in
adwords UI the change of status is not reflected.

I am using production account only.

CODE :

import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;

import com.google.api.adwords.lib.AdWordsService;
import com.google.api.adwords.lib.AdWordsUser;
import com.google.api.adwords.v13.AccountInterface;
import com.google.api.adwords.v13.AdGroupInterface;
import com.google.api.adwords.v13.AdInterface;
import com.google.api.adwords.v13.ApiError;
import com.google.api.adwords.v13.ApiException;
import com.google.api.adwords.v13.Campaign;
import com.google.api.adwords.v13.CampaignInterface;
import com.google.api.adwords.v13.Criterion;
import com.google.api.adwords.v13.CriterionInterface;
import com.google.api.adwords.v13.CriterionStatus;
import com.google.api.adwords.v13.Keyword;
import com.google.api.adwords.v13.Website;


public class KeywordTestReal {

        public static void main(String[] args) {
                int i, j, k;
                boolean accountCleaned = false;
                AdWordsUser user = new AdWordsUser
("*...@*.com","****","****","****","******","******");//commented for
security purposes.
                try {

                        CampaignInterface campaignService = user.getService
(AdWordsService.V13.CAMPAIGN_SERVICE);
                        AdGroupInterface adGroupService = user.getService
(AdWordsService.V13.ADGROUP_SERVICE);
                        AdInterface adService = user.getService
(AdWordsService.V13.AD_SERVICE);
                        CriterionInterface criterionService = user.getService
(AdWordsService.V13.CRITERION_SERVICE);

                        long []ids = new long[1];
                        ids[0] = 11897671;
                        Criterion[] criteria = null;
                        try {
                                criteria = 
criterionService.getCriteria(1598342449l, ids);
                        } catch (ApiException e) {
                                e.printStackTrace();
                        } catch (RemoteException e) {
                                e.printStackTrace();
                        }
                        ApiError[] errors = null;
                        Keyword key = (Keyword)criteria[0];
                        System.out.println("Keyword stats after fetching : 
"+key.getId()+"
>  "+key.getStatus().toString()+" > "+key.getText() );
                        key.setStatus(CriterionStatus.InActive);
                        System.out.println("Keyword stats after changing : 
"+key.getId()+"
>  "+key.getStatus().toString()+" > "+key.getText() );
                        try {
                                errors = criterionService.checkCriteria(new 
Criterion[]
{key},null,null);
                        } catch (ApiException e) {
                                e.printStackTrace();
                        } catch (RemoteException e) {
                                e.printStackTrace();
                        }
                        if (errors == null) {
                                try {
                                        criterionService.updateCriteria(new 
Criterion[]{key});
                                } catch (ApiException e) {
                                        e.printStackTrace();
                                } catch (RemoteException e) {
                                        e.printStackTrace();
                                }
                                criteria = null;
                                try {
                                        criteria = 
criterionService.getCriteria(1598342449l, ids);
                                } catch (ApiException e) {
                                        e.printStackTrace();
                                } catch (RemoteException e) {
                                        e.printStackTrace();
                                }
                                errors = null;
                                key = (Keyword)criteria[0];
                                System.out.println("Keyword stats after 
updating and fetching :
"+key.getId()+"  >  "+key.getStatus().toString()+" > "+key.getText
() );
                        } else {
                                System.out.println(errors.toString());
                        }

                } catch (ServiceException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
}


Thanks and regards
Rohit A

--

You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To post to this group, send email to adwords-...@googlegroups.com.
To unsubscribe from this group, send email to 
adwords-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en.


Reply via email to