The new OpenX API opens up a world of new possibilities for developers to automate common tasks associated with ad serving. Many publishers want to save time by getting direct advertisers to load up their own campaigns, so we’ve created a worked example showing how to use the API to create an ‘advertise on this site’ form.
By way of introduction, the OpenX ad server API is a web service which allows developers to control the ad server. It gives comprehensive access to the various objects in the ad server like advertisers, campaigns, zones, users… the list goes on. Loading up new campaigns and banners is a good example of how the API can be used.
The worked example builds a script which allows a user to enter details, upload an image file and have this data automatically captured into OpenX. It shows the core processes and functions necessary to allow a user to complete a simple form to load a campaign/banner created in your OpenX installation, ready for linking to your site.
The script could be extended in various ways to better suit your business. One logical next step would be to use the API’s getStats methods at the end of your billing cycle to gather statistics to feed into your invoicing/billing system.
Try the code for yourself, we’d love to see how you extend and improve it.
Using the API: Advertise on my site.