DoubleClick for Advertisers (DFA) API provides a comprehensive set of services that can be used to create applications that mediate all of your interactions with your DoubleClick account. But the API doesn't have to be used solely for making enterprise-level software solutions. Everyone, even DoubleClick clients who use the website interface for the majority of their trafficking needs, can create small scripts or programs to automate repetitive or laborious tasks. However, users of the website interface should first determine if exporting and importing Traffic Sheets could fulfil their needs. In either case, small API routines may be able to provide some value.
One case where the API can really shine is cleaning up a campaign. If you've got particularly long-running campaigns, or if you frequently change the ads shown in your placements based on dates, you can clean up all of the ads that have stopped running by archiving them and unassigning them from their placements. Ads will be automatically set to inactive for various reasons, the most important being if they have passed a hard cut-off date or if they've reached their delivery goals.
Looking at a snippet of the code from a program that would accomplish this demonstrates the two important parts - generating a record set and looping through all the pages in a paged record set, making changes as necessary: