How to properly decompress .json.gz file for asynchronous endpoint

restapi
v1
ads
api

#1

When I make a POST to the asynchronous stats endpoint, I am also now adding the header “Accept-encoding: gzip” for that post request. It said it was necessary only for requests made out to the asynch (POST) analytics endpoint https://dev.twitter.com/ads/reference/1/get/stats/jobs/accounts/%3Aaccount_id. All adding this header seemed to do I encode the response from the POST endpoint. So I decode the message and keep querying the GET 1/stats/jobs/accounts endpoint until I get the URL.

Now that I have the URL, how do I use this to get Twitter Ads stats data? My URL looks like https://ton.twimg.com/advertiser-api-async-analytics/[sensitive_info].json.gz


#2

The file is delivered in a compressed format so for example on Unix environment gunzip can be used tip unzip the data and view it as JSON. There is probably a library to use for the language you are developing your solution in like zlib for Ruby. We are adding support for this to our SDKs soon so please keep an eye on https://github.com/twitterdev/twitter-python-ads-sdk and https://github.com/twitterdev/twitter-ruby-ads-sdk

Thanks,

John


#3

Please note the issue presented here: V1 async reports missing required headers