googleads/googleads-dfa-reporting-samples

Multiple values for one parameter

rongdonw111 opened this issue · 1 comments

Hi!

I'm trying to send a request to pull placements from multiple Campaign IDs like below:
request = service.placements().list(profileId=5457275, campaignIds= [111, 222] )

But it doesn't allow me to enter multiple values in the CampaignIds parameter. However, if I test it on the Web version, you can click on "+" and add another campaign ID so the URL will show something like "CampaignIds=111&CampaignIds=222". If I do the same thing in Python, the "&" will be encoded so it doesn't work.

What is the right way to send multiple values to a parameter? Since the back-end already allows this and the parameter name is also a plural so I think it should be available in the Python code.

Thanks!

-Ronda

I'm also getting a similar problem when trying to list multiple campaigns, but limiting it to specific ones with given IDs. The documentation for v4 here says that we can pass a parameter ids to the list method of campaigns, but when I pass a list like ['some_id', 'another_id'], I get the following error

ValueError: URL-encoded content contains a repeated value:ids -> some_id, another_id

This may be a bug in how the values for this parameter are encoded. In my case, the query string indeed contains ids multiple times (similar to Ronda), something like ids=some_id&ids=another_id. When you pass this list of IDs to the list() method, shouldn't this be translated to something like ids=some_id,another_id?

This issue also occurs if we request ads with multiple campaignIds, which, according to the docs, should be possible.

It's sad that a Google product doesn't receive any attention. This issue has been opened for 3 years and no one has addressed it, although the solution might be quite simple, as this is most likely just a URL encoding problem.