Placeholder Feed Item Report - AttributeValues

27 views
Skip to first unread message

Danny

unread,
Aug 2, 2017, 12:53:54 PM8/2/17
to AdWords API Forum
Hi

I'm running the Placeholder Feed Item Report with the following fields:

$report_fields = ['PlaceholderType', 'FeedId', 'FeedItemId', 'AttributeValues', 'CustomerDescriptiveName','ExternalCustomerId', 'StartTime', 'EndTime', 'Status'];
$segment_fields = ['AdGroupId', 'AdGroupName', 'AdGroupStatus', 'CampaignId', 'CampaignName', 'CampaignStatus'];

In total, there's 15 fields being queried. Once I execute downloadReport() and saveToFile(), I noticed that the value of AttributeValues returns a JSON that for some reason the data is split into 2 columns. I'm running into errors as my header row is 15 fields, but the data returned is 16 fields.

Is this normal and if so, how does the API determine how/when should the AttributeValues JSON be split into multiple columns?

Danny

unread,
Aug 2, 2017, 12:55:40 PM8/2/17
to AdWords API Forum
FYI - using v201609 

Danny

unread,
Aug 2, 2017, 1:46:14 PM8/2/17
to AdWords API Forum
Ok nvm - I found the bug. Turns out the php functions str_getcsv and fgetcsv will process line breaks \n within a field, hence it's incorrectly splitting, and its possible to have line breaks within the JSON data of AttributeValues.

Danny

unread,
Aug 2, 2017, 2:00:36 PM8/2/17
to AdWords API Forum
I wonder if any \n in JSON data from API should be escaped then?

Shwetha Vastrad (AdWords API Team)

unread,
Aug 2, 2017, 3:26:36 PM8/2/17
to AdWords API Forum
Hi Danny, 

Items of a list which are in JSON format will be returned as an array of strings. The actual raw returned values are escaped appropriately for the selected report download format. You need to check if the CSV implementation supports embedded line breaks or newline characters inside text fields. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages