NAV Navbar
shell php
  • Introduction
  • Authentication
  • Error Handling
  • Methods
  • Introduction

    Your API Endpoint

    https://{your_name}.adglare.net/api/v2/{method_name}

    AdGlare's ad server API is organized around JSON, which is returned in all responses. In order to access the API, an API key can be created via the page Settings => API Settings from within your ad server portal.

    Your API endpoint URL can be found here at the right.

    Authentication

    Include your secret API key in the Authorization header when making a request.

    # Pass the Authorization header with each request
    curl "https://{your_name}.adglare.net/api/v2/{method_name}"
      -H "Authorization: Basic {api_key}"
    

    Authenticate your account by including your secret key in API requests. Authentication to the API is performed via HTTP Basic Auth. Provide your API key as the basic auth username. You do not need to provide a password.

    Authorization: Basic {api_key}

    Error Handling

    Example of an error.

    {
        "success": "0",
        "data": [{}],
        "errormsg": "There was an error.",
        "uri": "/api/v2/reports"
    }
    

    If an API request failed, the success variable will be set to 0, and errormsg will contain a description why the request failed.

    If a request was successful, success is set to 1.

    Methods

    List Campaigns

    curl "https://{your_name}.adglare.net/api/v2/campaigns"
      -H "Authorization: Basic {api_key}"
      -X POST
      -d ""
    

    Example Response:

    {
        "success": "1",
        "data": [{
            "cID": "501658124",
            "name": "My Campaign",
            "type": "Inline Media Ad",
            "created": "2018-12-07 17:08:00",
            "status": "active",
            "impressions": 3116,
            "clicks": 194,
            "conversions": 21,
            "weight": 60,
            "tier": 3,
            "assigned_zones": "ALL",
            "finance": {
                "pricing_model": "8.50 CPM",
                "costs": 26.486,
                "eCPM": 8.5,
                "eCPC": 0.1365
            }
        },
        {
            "cID": "663661327",
            "name": "Video Campaign",
            "type": "VAST Video Tag",
            "created": "2018-12-04 10:15:07",
            "status": "completed",
            "impressions": 525,
            "clicks": 34,
            "conversions": 2,
            "weight": 80,
            "tier": 1,
            "assigned_zones": "189928327#298928317",
            "finance": {
                "pricing_model": "1.00 CPC",
                "costs": 34,
                "eCPM": 64.7619,
                "eCPC": 1
            }
        }],
        "errormsg": "",
        "uri": "/api/v2/campaigns"
    }
    

    This endpoint returns a list of your campaigns.

    Endpoint

    POST https://{your_name}.adglare.net/api/v2/campaigns

    Query Parameters

    Parameter Required Description Example
    cID no Filter for this cID (campaign ID). 501658124
    status no Filter. Either active, onhold, completed, archived. active
    include_finance no Either true or false. true

    List Zones

    curl "https://{your_name}.adglare.net/api/v2/zones"
      -H "Authorization: Basic {api_key}"
      -X POST
      -d ""
    

    Example Response:

    {
        "success": "1",
        "data": [{
            "zID": "646374028",
            "name": "My Zone",
            "type": "Inline Media Ad",
            "created": "2018-12-04 09:40:51",
            "status": "active",
            "ad_requests": 129571,
            "impressions": 129568,
            "clicks": 5643,
            "finance": {
                "revenue": 1205.2825,
                "eCPM": 9.3023,
                "eCPC": 0.2135
            }
        },
        {
            "zID": "185738534",
            "name": "Another Zone",
            "type": "VAST Video Tag",
            "created": "2018-12-02 11:03:32",
            "status": "onhold",
            "ad_requests": 7224,
            "impressions": 7221,
            "clicks": 840,
            "finance": {
                "revenue": 25.2825,
                "eCPM": 3.5012,
                "eCPC": 0.0300
            }
        }],
        "errormsg": "",
        "uri": "/api/v2/zones"
    }
    

    This endpoint returns a list of your zones.

    Endpoint

    POST https://{your_name}.adglare.net/api/v2/zones

    Query Parameters

    Parameter Required Description Example
    zID no Filter for this zID (zone ID). 646374028
    status no Filter. Either active or onhold. active
    include_finance no Either true or false. true

    Campaign Reports

    curl "https://{your_name}.adglare.net/api/v2/reports/campaigns"
      -H "Authorization: Basic {api_key}"
      -X POST
      -d "from=2018-12-07&until=2018-12-14"
    

    Example Response:

    {
        "success": "1",
        "data": [{
            "cID": 232376497,
            "campaign_name": "My Campaign",
            "summary": {
                "impressions": 7434324,
                "clicks": 118949,
                "conversions": 654,
                "finance": {
                    "pricing_model": "-",
                    "costs": 0,
                    "eCPM": 0,
                    "eCPC": 0
                }
            },
            "dataset": {
                "impressions": {
                    "adsize": {
                        "225x225": 1,
                        "300x250": 7434323
                    },
                    "adtype": {
                        "Inline Media Ad": 7434324
                    },
                    "browser": {
                        "Chrome": 7434324
                    },
                    "country": {
                        "USA": 7434324
                    },
                    "crID": {
                        "561719638": 1,
                        "824527143": 1,
                        "683828157": 7434322
                    },
                    "device": {
                        "Desktop": 7434303,
                        "Mobile": 20,
                        "Tablet": 1
                    },
                    "domain": {
                        "exampledomain.com": 7434316,
                        "anotherdomain.com": 8
                    },
                    "isbot": {
                        "no": 7434022,
                        "yes": 302
                    },
                    "language": {
                        "en": 7434324
                    },
                    "os": {
                        "Windows": 7434324
                    },
                    "ssl": {
                        "yes": 7434323,
                        "no": 1
                    }
                },
                "clicks": {
                    "adsize": [],
                    "adtype": [],
                    "browser": [],
                    "country": [],
                    "crID": [],
                    "device": [],
                    "domain": [],
                    "isbot": [],
                    "language": [],
                    "os": [],
                    "ssl": []
                },
                "conversions": "etc..."
            }
        },{
            "cID": 501658124,
            "campaign_name": "Another Campaign",
            "summary": {
                "impressions": 166439,
                "clicks": 3828,
                "conversions": 12,
                "finance": {
                    "pricing_model": "8.50 CPM",
                    "costs": 1414.73,
                    "eCPM": 8.50,
                    "eCPC": 0.3695
                }
            },
            "dataset": "etc..."
        }],
        "errormsg": "",
        "uri": "/api/v2/reports/campaigns"
    }
    

    This endpoint returns statistical data about your campaigns.

    Endpoint

    POST https://{your_name}.adglare.net/api/v2/reports/campaigns

    Query Parameters

    Parameter Required Description Example
    from yes The start date of the result set in YYYY-MM-DD. 2018-12-07
    until yes The end date of the result set in YYYY-MM-DD. 2018-12-14
    cID no Filter for this cID (campaign ID). 501658124
    include_dataset no Either true or false. true

    Zone Reports

    curl "https://{your_name}.adglare.net/api/v2/reports/zones"
      -H "Authorization: Basic {api_key}"
      -X POST
      -d "from=2018-12-07&until=2018-12-14"
    

    Example Response:

    {
        "success": "1",
        "data": [{
            "zID": 651128504,
            "zone_name": "My Zone",
            "summary": {
                "impressions": 7434324,
                "clicks": 118949,
                "finance": {
                    "revenue": 0,
                    "eCPM": 0,
                    "eCPC": 0
                }
            },
            "dataset": {
                "impressions": {
                    "adsize": {
                        "225x225": 1,
                        "300x250": 7434323
                    },
                    "adtype": {
                        "Inline Media Ad": 7434324
                    },
                    "browser": {
                        "Chrome": 7434324
                    },
                    "cID": {
                        "608678224": 7434324
                    },
                    "country": {
                        "USA": 7434324
                    },
                    "crID": {
                        "561719638": 1,
                        "824527143": 1,
                        "683828157": 7434322
                    },
                    "device": {
                        "Desktop": 7434303,
                        "Mobile": 20,
                        "Tablet": 1
                    },
                    "domain": {
                        "exampledomain.com": 7434316,
                        "anotherdomain.com": 8
                    },
                    "isbot": {
                        "no": 7434022,
                        "yes": 302
                    },
                    "language": {
                        "en": 7434324
                    },
                    "os": {
                        "Windows": 7434324
                    },
                    "ssl": {
                        "yes": 7434323,
                        "no": 1
                    }
                },
                "clicks": "etc..."
            }
        },{
            "zID": 764397223,
            "zone_name": "Another Zone",
            "summary": {
                "impressions": 166439,
                "clicks": 3828,
                "finance": {
                   "revenue": 1414.73,
                   "eCPM": 8.50,
                   "eCPC": 0.3695
                }
            },
            "dataset": "etc..."
        }],
        "errormsg": "",
        "uri": "/api/v2/reports/zones"
    }
    

    This endpoint returns statistical data about your zones.

    Endpoint

    POST https://{your_name}.adglare.net/api/v2/reports/zones

    Query Parameters

    Parameter Required Description Example
    from yes The start date of the result set in YYYY-MM-DD. 2018-12-07
    until yes The end date of the result set in YYYY-MM-DD. 2018-12-14
    zID no Filter for this zID (zone ID). 764397223
    include_dataset no Either true or false. true

    Ad Request Reports

    curl "https://{your_name}.adglare.net/api/v2/reports/adrequests"
      -H "Authorization: Basic {api_key}"
      -X POST
      -d "from=2018-12-07&until=2018-12-14"
    

    Example Response:

    {
        "success": "1",
        "data": [{
            "zID": 651128504,
            "zone_name": "My Zone",
            "summary": {
                "ad_requests": 7434324
            },
            "dataset": {
                "ad_requests": {
                    "browser": {
                        "Chrome": 5575743,
                        "FireFox": 1858581
                    },
                    "country": {
                        "USA": 7434324
                    },
                    "device": {
                        "Desktop": 7434324
                    },
                    "domain": {
                        "exampledomain.com": 7434324
                    },
                    "isbot": {
                        "no": 7421550,
                        "yes": 12774
                    },
                    "language": {
                        "en": 7434324
                    },
                    "os": {
                        "Windows": 7434324
                    },
                    "ssl": {
                        "yes": 7434324
                    }
                }
            }
        }],
        "errormsg": "",
        "uri": "/api/v2/reports/adrequests"
    }
    

    This endpoint returns statistical data about your ad requests.

    Endpoint

    POST https://{your_name}.adglare.net/api/v2/reports/adrequests

    Query Parameters

    Parameter Required Description Example
    from yes The start date of the result set in YYYY-MM-DD. 2018-12-07
    until yes The end date of the result set in YYYY-MM-DD. 2018-12-14
    zID no Filter for this zID (zone ID). 764397223
    include_dataset no Either true or false. true

    AdGlare Ad Server Logo
    All rights reserved. Copyright © 2013 - 2018 AdGlare Ad Server.