Hi!
I have a problem with creating extensions on account level through the API 
(v201603, PHP).
In new account where there are no structured snippet extensions I am 
creating new feed for structured snipped extensions and new extension in it 
and on Campaigns / Ad Extensions screen I don't see it in account. Also I 
get this error:
"There was an error with your operation. If you were trying to make a 
change, it may not have saved. Please refresh this page to try again.
If the error continues, log out of your AdWords account, then log in again 
and return to this page. "
Here is the workflow:
First I search for existing feeds through the API, here is my AWQL query:
SELECT Id, Name, Attributes WHERE FeedStatus="ENABLED" AND Name IN ["_Main 
structured snippet feed", "Main structured snippet feed"]
I get nothing.
When I try to create "_Main structured snippet feed" I get 
FeedError.INVALID_FEED_NAME.
But when I create it without "_" at first all seems fine and the feed and 
extension are created successfully, but I get this error "There was an 
error with your operation..." http://screencloud.net/v/2Fz5 on the 
Campaigns / Ad extensions screen (http://screencloud.net/v/i6d9)
And the extension is not visible in this tab.
But when I try to create new extension manually in the default feed - I see 
both feeds
http://screencloud.net/v/tSc5
, and after creating it in "_Main..." account - it is available, but 
"Main..." account created through the api seems broken:
http://screencloud.net/v/nlUa
If there are already at least one extension in "_Main..." feed - it is 
available through the API and everything is fine. But in new accounts when 
there are no extensions this feed is unavailable, but seems like existing 
and hidden.
Here is this extension feed in Shared Library:
http://screencloud.net/v/x69p
http://screencloud.net/v/50EC
And I don't see any difference with the extension I created manually 
through the adwords interface:
http://screencloud.net/v/ukt3
http://screencloud.net/v/p0Wt

Can somebody explain what am I doing wrong or how can I retrieve default 
"_Main structured snippet feed" when there are no extensions in it?

Here is my Php code for creating feed and structured snippet extension:

// Get the FeedService, which loads the required classes.
$feedService = $user->GetService('FeedService', self::ADWORDS_VERSION);
$attributeName = self::EXT_SNIPPET_ATTRIBUTE_NAME;
$placeholderType = self::EXT_PLACEHOLDER_SNIPPET;
// Create attributes.
$textAttribute = new \FeedAttribute();
$textAttribute->type = 'STRING';
$textAttribute->name = $attributeName;
// Create the feed.
$feed = new \Feed();
$feed->name = $feedName;
$feed->attributes = [$textAttribute];
$feed->origin = 'USER';
// Additional snippet fields
$valueAttribute = new \FeedAttribute();
$valueAttribute->type = 'STRING_LIST';
$valueAttribute->name = self::EXT_SNIPPET_ATTRIBUTE_NAME_ADDITIONAL;
$feed->attributes[] = $valueAttribute;
// Create operation.
$operation = new \FeedOperation();
$operation->operator = 'ADD';
$operation->operand = $feed;
$operations = [$operation];
// Add the feed.
$result = self::mutate($feedService, $operations);
$savedFeed = $result->value[0];
// now we need to map this feed according to $type
$feedMappingService = $user->GetService('FeedMappingService', self::
ADWORDS_VERSION);
// Map the FeedAttributeIds to the fieldId constants.
$textFieldMapping = new \AttributeFieldMapping();
$textFieldMapping->feedAttributeId = $savedFeed->attributes[0]->id;
$textFieldMapping->fieldId = 1;
$feedMapping = new \FeedMapping();
$feedMapping->placeholderType = $placeholderType;
$feedMapping->feedId = $savedFeed->id;
$feedMapping->attributeFieldMappings = [$textFieldMapping];
$operation = new \FeedMappingOperation();
$operation->operand = $feedMapping;
$operation->operator = 'ADD';
$operations = [$operation];
// Save the field mapping.
$result = self::mutate($feedMappingService, $operations);


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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-api@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
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/ab932cc1-f6d4-4be0-8c5d-8744aa263f07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to