Twitter Ads API SDK for Ruby granularity not working

ruby

#1

I am using the Ruby Ads Api SDK and when I add parameters for start_time, end_time and granularity it doesn’t affect the number of responses I get, and the response doesn’t include a reference to the relevant date for those stats. I’m using something like…

TwitterAds::LineItem.stats(account, [line_item.id], [‘ENGAGEMENT’], start_time: ‘2017-03-12T00:00:00Z’, end_time: ‘2017-03-14T00:00:00Z’, granularity: ‘DAY’)

And it returns the reponse[:data], excluding the request information.
Please help or let me know how I can get metrics for a line item between a range of dates, broken down by day.


#2

I would recommend to test hitting the same stats endpoint with Twurl command line tool (and pipe it to jsonpretty or json prettification utility) to understand the structure that is returned. If you think the one via SDK is not returning the same information or it’s difficult to parse it would be a problem with the SDK itself and you can raise it directly upon GitHub for best visibility.

Thanks,
John


#3

Thanks John, got it working fine now :slight_smile: