Error in creating an Async Report Job for Multiple Metric Groups




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-,BILLING&placement=ALL_ON_TWITTER&start_time=2016-06-06T12:00:00Z"

Any pointers on what could be going wrong here…


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



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…


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:


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


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



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


Or in your local machine.


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.


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…


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 ( suggests that a comma character should be encoded to %2C, so am assuming its correct