Sizes not returned by AppNexus API

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.

+8
rest api
source share
2 answers

The AppNexus console ( Appnexus web interface) uses the same API to provide content.

If you can create the output you are looking for by running the report, you can reverse engineer the API calls by clicking "OPEN API VIEW" at the bottom of the screen. This will show you the API parameters used to create the report.

+1
source share

The AppNexus developer is here (in a few months!). I am sure that, for example, calling the error reporting API on this page was wrong (and I just fixed it - you can check it out here ).

My understanding after testing reports API requests:

  • The "bad" example from the docs doesn't work (as you said - now fixed)
  • You get group behavior while you group the data (using "row_per") that you explicitly requested (using the "columns").

In other words, you should query the data fields in the columns, and then group them (or rather a subset) with "row_per". Here is an example that I used in the updated docs:

 { "report": { "report_type": "publisher_analytics", "report_interval": "yesterday", "columns": [ "geo_country", "imp_type", "placement", "clicks", "total_convs", "publisher_revenue" ], "groups": [ "geo_country", "imp_type", "placement", "imps_total" ], "name": "Publisher Analytics - 10/30/2015" } } 

I used the quotes around the β€œbad” above because I'm not sure if this is a bug in our API or the expected behavior - I try to find this with our engineering team now, but on Friday afternoon, so I may need to register again later.

In any case, I updated the example on the page to reflect the actual behavior currently verified.

Two more things:

  • This page for our regular publisher analytics report. This is not for mobile devices, we just published it there, so that it was accessible externally for some of our customers' clients. Sorry for the confusion!

  • According to my testing this afternoon, row_per and groups work and exhibit the same behavior.

I'm probably too late to help you, but hopefully this is useful to someone!

+1
source share

All Articles