Support Home > Advanced Tools > Custom Query > Pulling Custom Query Reports through the API

Pulling Custom Query Reports through the API

The following document provides guidance on the series of API calls that provide the opportunity to retrieve the current download link of a scheduled custom query API report on a recurring basis.


API Call Overview

  1. Schedule a custom Query through the Kochava UI. For more information about creating a custom query, refer to our Query support documentation.
  2. Use the following call/endpoint to retrieve the schedule token:
  3. NOTE: Reports scheduled through the UI are created with the first API key created for the user. If multiple API keys are associated to a user, be sure to use the first API key.

    https://reporting.api.kochava.com/v1.4/schedule/tokens

     

    {
       "api_key": "API-KEY",
       "app_guid": "APP GUID",
       "max_tokens": 10
    }
    

     

  4. Use the schedule token to make the following call:
  5. POST: https://reporting.api.kochava.com/v1.4/schedule/progress

     

    BODY:

    {
        "api_key": "AA11AA11-5F0C-4641-9E18-FA745A32B172",
        "app_guid": "kokochavabingodemo1347526e855c56f11", 
        "token":  "AA871393717333493AA"}
    }
    

     

  6. The call returns the current token:
  7. {
        "status": "scheduled",
        "status_date": "2017-08-01 01:00:08",
        "next_scheduled_on": "2017-09-01 00:00:00",
        "last_requested_token": "BB00015415042240BB",
        "report_type": "summary",
        "report_request": {
            "api_key": "AA11AA11-5F0C-4641-9E18-FA745A32B172",
            "app_guid": "kokochavabingodemo1347526e855c56f11",
            "traffic": [
                "click",
                "impression",
                "install"
            ],
            "traffic_grouping": [
                "network",
                "campaign",
                "tracker",
                "site",
                "creative",
                "country"
            ],
            "time_series": "24",
            "traffic_filtering": {
                "country": [
                    "US"
                ],
                "network": [
                    "9"
                ],
                "tracker": [
                    "4718722"
                ]
            },
            "time_zone": "Singapore",
            "delivery_format": "csv",
            "delivery_method": [
                "S3link"
            ],
            "notify": [
                "test@kochava.com"
            ],
            "frequency": "monthly",
            "run_on": "1",
            "previous_time": "1",
            "delay": "0",
            "template_name": "Network Summary"
        }
    }
    

     

  8. Use the current token to make the following call:
  9. POST: https://reporting.api.kochava.com/v1.4/progress

     

    BODY:

    {
        "api_key": "AA11AA11-5F0C-4641-9E18-FA745A32B172",
        "app_guid": "kokochavabingodemo1347526e855c56f11", 
        "token":  "BB00015415042240BB"}
    }
    

     

  10. The call will return the following payload, which includes the download link to the current report:
  11. {
        "status": "completed",
        "status_date": "2017-08-01 01:00:11",
        "progress": "100",
        "report": "http://kochava-reporting.s3.amazonaws.com/KRS_Sch900001541504224000_14398519_kokochavabingodemo1347526e855c56f11.click.install.impression_network.campaign.tracker.site.creative.country_201707010800-201708010800-TZ_Singapore-TS24h.country.network.tracker.csv?AWSAccessKeyId=AKIAJ4JWD2OCXDYVOG4B&Expires=1502413211&Signature=AaAaA1C4OLcl1c%2FLJhPrhwdxjdE%3D",
        "report_type": "summary",
        "report_request": {
            "api_key": "AA11AA11-5F0C-4641-9E18-FA745A32B172",
            "app_guid": "kokochavabingodemo1347526e855c56f11",
            "time_start": "1498896000",
            "time_end": "1501574400",
            "traffic": [
                "click",
                "impression",
                "install"
            ],
            "traffic_grouping": [
                "network",
                "campaign",
                "tracker",
                "site",
                "creative",
                "country"
            ],
            "time_series": "24",
            "traffic_filtering": {
                "country": [
                    "US"
                ],
                "network": [
                    "9"
                ],
                "tracker": [
                    "4718722"
                ]
            },
            "time_zone": "Singapore",
            "delivery_format": "csv",
            "delivery_method": [
                "S3link"
            ],
            "notify": [
                "test@kochava.com"
            ],
            "frequency": "monthly",
            "run_on": "1",
            "previous_time": "1",
            "delay": "0",
            "template_name": "Network Summary"
        }
    }
    

 
 

Last Modified: Dec 28, 2023 at 11:31 am