CustomerSyncError.INVALID_CAMPAIGN_ID Everytime i rerun the function.

183 views
Skip to first unread message

John Geliberte

unread,
Sep 10, 2015, 8:40:39 AM9/10/15
to AdWords API Forum
Hi guys, im having trouble every time i i run my CustomerSync Function.
i always got this error : 
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode: 
 faultString: [CustomerSyncError.INVALID_CAMPAIGN_ID @ selector]
 faultActor: 
 faultNode: 
 faultDetail: 
{https://adwords.google.com/api/adwords/ch/v201506}ApiExceptionFault:<message>[CustomerSyncError.INVALID_CAMPAIGN_ID @ selector]</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:CustomerSyncError"><fieldPath>selector</fieldPath><trigger/><errorString>CustomerSyncError.INVALID_CAMPAIGN_ID</errorString><ApiError.Type>CustomerSyncError</ApiError.Type><ns2:reason>INVALID_CAMPAIGN_ID</ns2:reason></errors>

[CustomerSyncError.INVALID_CAMPAIGN_ID @ selector]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)

My customer sync is in a loop for every 15 sec it will check if there is a new campaign added.
While my system is running and then i added a new campaign it will sent me back that error.

This is my code regarding this issue:

public static void getStatus(AdWordsServices adWordsServices, AdWordsSession session)
throws Exception {
// Get the CampaignService.
CampaignServiceInterface campaignService =
adWordsServices.get(session, CampaignServiceInterface.class);

// Get the CustomerSyncService.
CustomerSyncServiceInterface customerSyncService =
adWordsServices.get(session, CustomerSyncServiceInterface.class);

//ResultSyncEntity parentChecker = new ResultSyncEntity();


// Get a list of all campaign IDs.
List<Long> campaignIds = new ArrayList<Long>();
Selector selector = new SelectorBuilder()
.fields(CampaignField.Id)
.build();
CampaignPage campaigns = campaignService.get(selector);
if (campaigns.getEntries() != null) {
for (Campaign campaign : campaigns.getEntries()) {
campaignIds.add(campaign.getId());
}
}

// Create date time range for the past 24 hours.
DateTimeRange dateTimeRange = new DateTimeRange();
dateTimeRange.setMin(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date(System
.currentTimeMillis() - 1000L * 60 * 60 * 24)));
dateTimeRange.setMax(new SimpleDateFormat("yyyyMMdd HHmmss").format(new Date()));

// Create selector.
CustomerSyncSelector customerSyncSelector = new CustomerSyncSelector();
customerSyncSelector.setDateTimeRange(dateTimeRange);
customerSyncSelector
.setCampaignIds(ArrayUtils.toPrimitive(campaignIds.toArray(new Long[] {})));

// Get all account changes for campaign.
CustomerChangeData accountChanges = customerSyncService.get(customerSyncSelector);

// Display changes.
if (accountChanges != null && accountChanges.getChangedCampaigns() != null) {
System.out.println("Most recent change: "
+ accountChanges.getLastChangeTimestamp() + "\n");

ResultSyncEntity.setCheckLastDateChecked(accountChanges.getLastChangeTimestamp());

for (CampaignChangeData campaignChanges : accountChanges.getChangedCampaigns()) {
System.out.println("Campaign with id \"" + campaignChanges.getCampaignId()
+ "\" was changed: ");
System.out.println("\tCampaign changed status: "
+ campaignChanges.getCampaignChangeStatus());
StatusChecker = campaignChanges.getCampaignChangeStatus().toString();
if (StatusChecker == "NEW")
{
ChildCampaignId = campaignChanges.getCampaignId();
fetchCampaigns(adWordsServices, session);

}else
{

}


}
} else {
System.out.println("No account changes were found.");
}
}

 Hope you guys can help me determine what cause and what is the fix for this issue thanks.

Josh Radcliff (AdWords API Team)

unread,
Sep 10, 2015, 6:42:16 PM9/10/15
to AdWords API Forum
Hi,

Thanks for raising this -- I was able to reproduce this issue as well. I've reported it and will let you know as soon as I have an update.

In the meantime, one work around would be to catch the INVALID_CAMPAIGN_ID error if it occurs, then wait 5-10 seconds and try the request again. I realize this isn't ideal, but it will at least allow your app to gracefully handle this problem while we're investigating.

Thanks,
Josh, AdWords API Team

John Geliberte

unread,
Sep 10, 2015, 9:56:23 PM9/10/15
to AdWords API Forum
Thank you sir, i hope to get some updates soon sir.

John Geliberte

unread,
Sep 16, 2015, 6:49:21 AM9/16/15
to AdWords API Forum
Hi, i did your advice by Catching the error and retrying it after 5-10 sec. but it didn't work for me. any update on this issue?


On Friday, September 11, 2015 at 6:42:16 AM UTC+8, Josh Radcliff (AdWords API Team) wrote:

Josh Radcliff (AdWords API Team)

unread,
Sep 16, 2015, 6:01:51 PM9/16/15
to AdWords API Forum
Hi,

No updates just yet. I'll post back to this topic as soon as I have more information.

Thanks,
Josh, AdWords API Team

Albert Catama

unread,
Oct 29, 2015, 8:59:30 AM10/29/15
to AdWords API Forum
I have the same problem, any update?

Thanks!

Josh Radcliff (AdWords API Team)

unread,
Oct 29, 2015, 4:38:30 PM10/29/15
to AdWords API Forum
Hi,

Although we are considering options for addressing this issue, we don't have any immediate plans to change the behavior of the service. I'd recommend adding retry logic to work around this limitation for the time being.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages