How to Get Google Ads Response in Array or Json

74 views
Skip to first unread message

Sandeep Yadav

unread,
Jun 3, 2019, 2:54:06 AM6/3/19
to AdWords API and Google Ads API Forum
Hi Everyone,

 I am using the Google AdWords API to get campaigns reports. While I am accessing the reports using getAsString()   then I can see the report is being downloaded into excel format.

I don't want a report to be download. I want the result in an array or JSON.

Can you please help me to fix this issues.

Thank  You

Google Ads API Forum Advisor Prod

unread,
Jun 3, 2019, 3:38:40 AM6/3/19
to adwor...@googlegroups.com
Hi Sandeep,

In the AdWords API reporting, I'm afraid the JSON output is currently not supported. You will need to download the report as is and convert it to a JSON format on your end post download.

You may also want to check out the new Google Ads API as this already supports JSON format when passing and retrieving data.

Thanks and regards,
Peter
Google Ads API Team

ref:_00D1U1174p._5001UBl7lQ:ref

Sandeep Yadav

unread,
Jun 3, 2019, 3:44:07 AM6/3/19
to adsapifor...@gmail.com, adwor...@googlegroups.com
Hi  Peter,

Thanks For your response. If JSON Format not support, then how to convert response in an array.Because I want to insert response into the database. Please Help to resolve this issue.

Thanks
Sandeep

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/x1jHM000000000000000000000000000000000000000000000PSIIJX00R6dp9KS_TIuIAHkgau1wmg%40sfdc.net.

Ravi Chandran

unread,
Dec 20, 2019, 7:37:34 AM12/20/19
to AdWords API and Google Ads API Forum
Hi Sandeep,

I got the response as you expected, 
  • Use download type as XML
  • Use getStream() to get data
  • Use simplexml_load_string to load the content
  • Convert to json
That's it. 

I hope it may help you. 
Reply all
Reply to author
Forward
0 new messages