I am trying to establish integration with the AppNexus Reporting API , ran into problems and wondered if anyone in the StackOverflow community can share information.
There is walking in the AppNexus API, but using curl and sorting it, except that groups / dimensions are not returned. Here is what I did:
There is a file called auth that contains our credentials:
# JSON file containing our credentials $ cat auth { "auth": { "username" : "ourAppNexusApiUsername", "password" : "ourSecretApiUserPassword" } }
There is also a JSON file containing the request. Pay attention to the sizes in the "columns" list:
# The query itself, in JSON format. $ cat query.json { "report": { "format": "csv", "report_interval": "yesterday", "groups": [ "publisher_id", "imp_type", "geo_country", "placement_id" ], "columns": [ "imps_total", "imps_kept", "imps_resold", "publisher_filled_revenue", "total_convs" ], "report_type": "publisher_analytics" } }
I can authenticate:
$ curl -b cookies -c cookies -X POST -d @auth 'https://api.appnexus.com/auth' {"response":{"status":"OK","token":"hbapi:133820:5571c87753c27:nym2","dbg_info":{"instance":"56.bm-hbapi.prod.lax1","slave_hit":false,"db":"master","parent_dbg_info":{"instance":"63.bm-hbapi.prod.nym2","slave_hit":false,"db":"master","parent_dbg_info":{"instance":"38.bm-api.prod.nym2","slave_hit":false,"db":"master","time":482.32913017273,"version":"1.15.279","warnings":[],"slave_lag":0,"start_microtime":1433520246.311},"awesomesauce_cache_used":false,"count_cache_used":false,"warnings":[],"time":1078.0298709869,"start_microtime":1433520246.2796,"version":"1.15.527","slave_lag":0,"output_term":"not_found"},"awesomesauce_cache_used":false,"count_cache_used":false,"warnings":[],"time":1360.9290122986,"start_microtime":1433520246.1491,"version":"1.15.527","slave_lag":1,"output_term":"not_found","master_instance":"63.bm-hbapi.prod.nym2","proxy":true,"master_time":1078.0298709869}}}
I can request a report for this publisher. It returns a report_id : 72734c3a2df81522c7bae6684cfdd65c
$ curl -b cookies -c cookies -X POST -d @query.json 'http://api.appnexus.com/report?publisher_id=510332' {"response":{"status":"OK","report_id":"72734c3a2df81522c7bae6684cfdd65c","existing":false,"cached":true,"dbg_info":{"instance":"58.bm-hbapi.prod.lax1","slave_hit":false,"db":"master","reads":0,"read_limit":100,"read_limit_seconds":60,"writes":1,"write_limit":60,"write_limit_seconds":60,"parent_dbg_info":{"instance":"61.bm-hbapi.prod.nym2","slave_hit":false,"db":"master","reads":0,"read_limit":100,"read_limit_seconds":60,"writes":1,"write_limit":60,"write_limit_seconds":60,"awesomesauce_cache_used":false,"count_cache_used":false,"warnings":[],"time":264.3940448761,"start_microtime":1433520268.8354,"version":"1.15.527","output_term":"not_found","reporting_dbg_info":{"instance":"11.bm-report-processor.prod.nym2","version":"1.72.130","time":1094.5529937744,"start_microtime":1433520268,"warnings":[],"api_cache_hit":"0","output_term":null}},"awesomesauce_cache_used":false,"count_cache_used":false,"warnings":[],"time":1238.8980388641,"start_microtime":1433520267.9206,"version":"1.15.527","output_term":"not_found","master_instance":"61.bm-hbapi.prod.nym2","proxy":true,"master_time":264.3940448761}}}
I can download the report, but, unfortunately, the report groups are missing:
$ curl -b cookies -c cookies 'http://api.appnexus.com/report-download?id=72734c3a2df81522c7bae6684cfdd65c' imps_total,imps_kept,imps_resold,publisher_filled_revenue,total_convs 65086432,0,42898432,1234.776809,4
I guess I'm not the first person to come across. Anyone have any thoughts / suggestions?
Edit:
I uploaded a quick and dirty Python script to the Github repository to make testing easier.
In addition, AppNexus responded by email:
It looks like you got some kind of documentation for mobile devices and not for our standard publisher analytics report. You should change the "groups" to "row_per" as follows: "
{ "report": { "format": "csv", "report_interval": "yesterday", "row_per": [ "hour" ], "columns": [ "imps_total" ], "report_type": "publisher_analytics" } }
I tried this, but it did not work.