Hello,
to my understanding, GoogleAdsService is there to perform atomic operations across different entities/services, such as campaign+buget. We have tried to create sitelink+association in 1 atomic operation using the same API but it doesn't work, failing on an error that says that we cannot set ResourceName on SitelinkFeedItem when in CREATE operation.
Is it possible to create sitelinks and an association in 1 submit? It would be a perfect use case for GoogleAdsService.
This is our code (C#):
var adGroupResourceName = CreateAdGroup(campaignResourceName, $"{sitelinkPrefix}{i}");
var extensionFeedItemOperation = new GoogleV5Services.MutateOperation()
{
ExtensionFeedItemOperation = new GoogleV5Services.ExtensionFeedItemOperation()
{
Create = new GoogleV5Resources.ExtensionFeedItem()
{
// Create your sitelinks.
SitelinkFeedItem = new GoogleV5Common.SitelinkFeedItem()
{
LinkText = $"{sitelinkPrefix}{i}_1",
FinalUrls = { $"{url}{i}_1" },
},
ResourceName = $"customers/{customerId}/extensionFeedItems/-1",
}
}
};
var adGroupExtensionSetting = new GoogleV5Resources.AdGroupExtensionSetting()
{
AdGroup = adGroupResourceName,
ExtensionType = GoogleV5Enums.ExtensionTypeEnum.Types.ExtensionType.Sitelink,
ExtensionFeedItems = { $"customers/{customerId}/extensionFeedItems/-1" }
};
var adGroupExtensionSettingOperation = new GoogleV5Services.MutateOperation()
{
AdGroupExtensionSettingOperation = new GoogleV5Services.AdGroupExtensionSettingOperation()
{
Create = adGroupExtensionSetting,
}
};
var results = service.Mutate(customerId, new[] { extensionFeedItemOperation, adGroupExtensionSettingOperation }).MutateOperationResponses.ToArray();