Error in creating an Async Report Job for Multiple Metric Groups

ads
api

#1

Hello,

I am currently implementing an Async analytics data application, I have been able to successfully create the job, poll it and download the data using the URL returned from the GET request. But this is only when I specify only one value in the metrics_group parameter.

When I supply multiple comma separated values in the metrics_group paramter I start getting the UNAUTHORIZED_ACCESS Error with the message “This request is not properly authenticated”

Here is the URL I use in my POST Request to create a job. This works for all cases, except for multiple metrics groups-

https://ads-api.twitter.com/1/stats/jobs/accounts/4h2ib0?end_time=2016-07-07T12:00:00Z&entity=CAMPAIGN&entity_ids=1ap6j&granularity=HOUR&metric_groups=ENGAGEMENT,BILLING&placement=ALL_ON_TWITTER&start_time=2016-06-06T12:00:00Z"

Any pointers on what could be going wrong here…


#2

Have you tryed to to the request from TWURL and see if you’re getting the same error?

Thanks


#3

No I havent as yet. But the exact same request is working for me, when I supply only one metrc_group, like ENGAGEMENT or BILLING…


#4

So, maybe the problem is the way in your solution to join different elements in comma separated values.

Try it and we could see where’s the problem. Twitter or your app :smiley:


#5

Thanks for the reply…I am not really applying any algorithm to join the comma separated values, supplying a static string directly - “ENGAGEMENT,VIDEO”

That’s why I am confused why would I get an unauthorized error in this case, when my authentication etc is working fine otherwise


#6

Twitter also return Unauthorized access when he doesn’t understand the request. I really suggest you to try the request with TWURL.

Thanks


#7

Okay thanks. I do not have a TWURL Setup as yet. Will have to set it up on our server to try it out.


#8

Or in your local machine.


#9

And this may happen if the parameters are not encoded properly, @iProspectTech. Maybe that comma is getting encoded in a way different than what Twitter expects.


#10

Yes its not installed on my local machine as yet. I am able to run all twitter requests from my application (except this one of course), so did not need it before…


#11

Yeah that was my first thought as well. And I checked the encoding on it as well… Its getting encoded correctly to %2C.
The last example on this page (https://dev.twitter.com/oauth/overview/percent-encoding-parameters) suggests that a comma character should be encoded to %2C, so am assuming its correct