Structured response

When OpenX receives an ad requestCommunication from a web browser or app to an ad server to display an ad. for a structured response, it returns one of the supported response formats, which your custom application can interpret and render appropriately. It is a good idea to test a few ad requests to see what the response looks like. This way, you can review how OpenX represents its objects in its response, and make sure that your custom application configuration is able to handle the response.

In the case of a request for a JSONP response, when OpenX receives the ad request, it returns the JSON structure, wrapped in the JavaScript function, which was set in the ad request's callback parameter. The response from OpenX is a call to the specified JavaScript function, using the JSON structure as its input.

All structured responses contain the following elements for managing refresh:

  • refresh_delay represents the number of seconds to wait between ad reloads

  • refresh_max represents the maximum number of times to reload a new ad

To use these fields, your client application must:

  1. Identify the refresh_delay and refresh_max fields in the XML or JSON response.

  2. Append rc=COUNT where COUNT is replaced with the iteration of the reload (e.g., first refresh has rc=1 and third has rc=3).

    For example:

    max = response.refresh_max
    delay = response.refresh_delay
    for (i=1;i++;i<=refresh_max) {
      url = build_url() + "&rc=" + i