Search

US-12626272-B2 - Application program interface script caching and batching

US12626272B2US 12626272 B2US12626272 B2US 12626272B2US-12626272-B2

Abstract

Methods, systems, and apparatus, including computer programs encoded on a computer storage medium, for managing application program interface calls.

Inventors

  • Varouj A. Chitilian
  • Ilya Netchitailo
  • Nikhil Bakshi
  • Jiaqi Yu
  • Chetan Patel

Assignees

  • GOOGLE LLC

Dates

Publication Date
20260512
Application Date
20230810

Claims (20)

  1. 1 . A system, comprising: a data processing apparatus including one or more computers; and a computer storage system storing instructions that when executed by the data processing apparatus cause the data processing apparatus to perform operations comprising: executing a script for a rule in response to detecting an event defined by the rule, the rule further defining an operation for obtaining first data for each of a plurality of entities in response to detecting the event, the executing comprising: generating an application programming interface (API) call for the first data for each of the plurality of entities; determining that second data for each of the plurality of entities is not stored in a cache, the second data for each entity being different from the first data for each entity; and in response to determining that the second data for each of the plurality of entities is not stored in the cache, expanding the API call to include a request for the second data for each of the plurality of entities; receiving the first data and the second data for each of the plurality of entities; and storing the second data for each of the plurality of entities in the cache.
  2. 2 . The system of claim 1 , wherein the first data for each entity of the plurality of entities comprises data identifying each entity.
  3. 3 . The system of claim 1 , wherein the operation for obtaining the first data for each entity of the plurality of entities comprises an operation for obtaining data identifying each entity.
  4. 4 . The system of claim 1 , wherein the first data for each entity of the plurality of entities comprises a keyword and the second data for each entity of the plurality of entities comprises data indicating impressions related to the keyword.
  5. 5 . The system of claim 1 , wherein the operations comprise: executing an additional script for an additional rule in response to detecting an additional event defined by the additional rule, the additional rule further defining an additional operation for obtaining first data for each of a plurality of additional entities in response to detecting the additional event, the executing comprising: generating a second API call for the first data for each of the plurality of additional entities; determining that second data for each of the plurality of additional entities is stored in a cache, the second data for each additional entity being different from the first data for each additional entity; and in response to determining that the second data for each of the plurality of additional entities is stored in the cache, obtaining the second data for each of the plurality of additional entities from the cache.
  6. 6 . The system of claim 1 , wherein the first data and the second data for each of the plurality of entities comprises a set of data, and wherein expanding the API call to include the request for the second data for each of the plurality of entities comprises: determining that an initial expanded API call exceeds a cardinality limit; and in response to determining that the initial expanded API call exceeds the cardinality limit: generating a first API call for a first portion of the set of data; and generating one or more additional API calls for one or more remaining portions of the set of data.
  7. 7 . The system of claim 6 , wherein the operations comprise: determining, for each of a plurality of entity quantities, respective success rate of previous API calls for a number of entities that matches the entity quantity; and determining the cardinality limit based on each respective success rate.
  8. 8 . A method performed by a data processing apparatus, the method comprising: executing a script for a rule in response to detecting an event defined by the rule, the rule further defining an operation for obtaining first data for each of a plurality of entities in response to detecting the event, the executing comprising: generating an application programming interface (API) call for the first data for each of the plurality of entities; determining that second data for each of the plurality of entities is not stored in a cache, the second data for each entity being different from the first data for each entity; and in response to determining that the second data for each of the plurality of entities is not stored in the cache, expanding the API call to include a request for the second data for each of the plurality of entities; receiving the first data and the second data for each of the plurality of entities; and storing the second data for each of the plurality of entities in the cache.
  9. 9 . The method of claim 8 , wherein the first data for each entity of the plurality of entities comprises data identifying each entity.
  10. 10 . The method of claim 8 , wherein the operation for obtaining the first data for each entity of the plurality of entities comprises an operation for obtaining data identifying each entity.
  11. 11 . The method of claim 8 , wherein the first data for each entity of the plurality of entities comprises a keyword and the second data for each entity of the plurality of entities comprises data indicating impressions related to the keyword.
  12. 12 . The method of claim 8 , further comprising: executing an additional script for an additional rule in response to detecting an additional event defined by the additional rule, the additional rule further defining an additional operation for obtaining first data for each of a plurality of additional entities in response to detecting the additional event, the executing comprising: generating a second API call for the first data for each of the plurality of additional entities; determining that second data for each of the plurality of additional entities is stored in a cache, the second data for each additional entity being different from the first data for each additional entity; and in response to determining that the second data for each of the plurality of additional entities is stored in the cache, obtaining the second data for each of the plurality of additional entities from the cache.
  13. 13 . The method of claim 8 , wherein the first data and the second data for each of the plurality of entities comprises a set of data, and wherein expanding the API call to include the request for the second data for each of the plurality of entities comprises: determining that an initial expanded API call exceeds a cardinality limit; and in response to determining that the initial expanded API call exceeds the cardinality limit: generating a first API call for a first portion of the set of data; and generating one or more additional API calls for one or more remaining portions of the set of data.
  14. 14 . The method of claim 13 , further comprising: determining, for each of a plurality of entity quantities, respective success rate of previous API calls for a number of entities that matches the entity quantity; and determining the cardinality limit based on each respective success rate.
  15. 15 . A non-transitory computer readable storage medium storing software instructions executable by a data processing apparatus and that upon such execution cause the data processing apparatus to perform operations comprising: executing a script for a rule in response to detecting an event defined by the rule, the rule further defining an operation for obtaining first data for each of a plurality of entities in response to detecting the event, the executing comprising: generating an application programming interface (API) call for the first data for each of the plurality of entities; determining that second data for each of the plurality of entities is not stored in a cache, the second data for each entity being different from the first data for each entity; and in response to determining that the second data for each of the plurality of entities is not stored in the cache, expanding the API call to include a request for the second data for each of the plurality of entities; receiving the first data and the second data for each of the plurality of entities; and storing the second data for each of the plurality of entities in the cache.
  16. 16 . The non-transitory computer readable storage medium of claim 15 , wherein the first data for each entity of the plurality of entities comprises data identifying each entity.
  17. 17 . The non-transitory computer readable storage medium of claim 15 , wherein the operation for obtaining the first data for each entity of the plurality of entities comprises an operation for obtaining data identifying each entity.
  18. 18 . The non-transitory computer readable storage medium of claim 15 , wherein the first data for each entity of the plurality of entities comprises a keyword and the second data for each entity of the plurality of entities comprises data indicating impressions related to the keyword.
  19. 19 . The non-transitory computer readable storage medium of claim 15 , wherein the operations comprise: executing an additional script for an additional rule in response to detecting an additional event defined by the additional rule, the additional rule further defining an additional operation for obtaining first data for each of a plurality of additional entities in response to detecting the additional event, the executing comprising: generating a second API call for the first data for each of the plurality of additional entities; determining that second data for each of the plurality of additional entities is stored in a cache, the second data for each additional entity being different from the first data for each additional entity; and in response to determining that the second data for each of the plurality of additional entities is stored in the cache, obtaining the second data for each of the plurality of additional entities from the cache.
  20. 20 . The non-transitory computer readable storage medium of claim 15 , wherein the first data and the second data for each of the plurality of entities comprises a set of data, and wherein expanding the API call to include the request for the second data for each of the plurality of entities comprises: determining that an initial expanded API call exceeds a cardinality limit; and in response to determining that the initial expanded API call exceeds the cardinality limit: generating a first API call for a first portion of the set of data; and generating one or more additional API calls for one or more remaining portions of the set of data.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation application of, and claims priority to, U.S. patent application Ser. No. 16/862,322, now U.S. Pat. No. 11,769,170, titled “APPLICATION PROGRAM INTERFACE SCRIPT CACHING AND BATCHING,” filed on Apr. 29, 2020, which application is a continuation application of, and claims priority to, U.S. patent application Ser. No. 13/474,977, now U.S. Pat. No. 10,679,240, titled “APPLICATION PROGRAM INTERFACE SCRIPT CACHING AND BATCHING,” filed on May 18, 2012, which application claims the benefit under 35 U.S.C. § 119 (e) of U.S. Patent Application No. 61/525,459, entitled “Advertiser Campaign Scripting,” filed Aug. 19, 2011; U.S. Patent Application No. 61/555,092, entitled “Advertiser Campaign Script Execution Management,” filed Nov. 3, 2011; U.S. Patent Application No. 61/555,086, entitled “Advertiser Service Scripting,” filed Nov. 3, 2011; U.S. Patent Application No. 61/555,068, entitled “Application Program Interface Script Caching And Batching,” filed Nov. 3, 2011; and U.S. Patent Application No. 61/555,071, entitled “Advertising Campaign Script Execution Management,” filed Nov. 3, 2011. The disclosure of each of the foregoing applications is incorporated herein by reference in their entirety. BACKGROUND This specification relates managing application program interface calls for script execution in, for example, an advertising management environment. The Internet enables access to a wide variety of content items, e.g., video and/or audio files, web pages for particular subjects, news articles, etc. Such access to these content items likewise enables opportunities for targeted advertising. For example, advertisements can be provided with search results in response to a search query provided by a user; provided for web pages of third party online publishers that have content related to the advertisement; or provided in response to a specific request from a user, such as when a user requests information for particular products or services. An advertising management system can be used to facilitate the value exchange between advertisers and publishers. Advertisers provide advertisements, specify targeting criteria for ad campaigns, and offer bids for the opportunities to have their advertisements presented on publishers' webpages. Online advertisers use advertising management tools to manage their advertising campaigns. These management tools include an account interface that allows an advertiser to create and define various aspects of advertising campaigns and ad groups, such as keywords, targeting criteria, budgets, bids for ad placement, duration, different types of advertisements, and so on. After the advertiser has specified the campaign and ad group data and activated the advertising campaigns and/or ad groups, advertisements can be dynamically selected and served on publishers' webpages according to the various keywords and other targeting criteria specified by the advertiser. Once an advertising campaign is launched, and advertiser uses the advertising management tools to monitor the performance of the advertising campaign. One system allows the use of scripts to manage an advertising campaign. Depending on the performance of the advertising campaign, execution of the script results in changes to targeting, bids, budgets, advertisements, etc., of the advertising campaign. However, the advertising campaign may have thousands of bids, tens of thousands of targeting criteria, and various other associated data. In the situation in which a script execution engine is implemented in a manner in which the script execution engine must communicate with the advertisement management system though one or more APIs, requests for data and changes to data may result in tens of thousands of data elements being requested and modified for a script execution in an API call. This can result in multiple API calls between the respective systems, and some API calls may be prone to failure due to the sheer size of the data set(s) underlying the call. SUMMARY In general, one innovative aspect of the subject matter described in this specification can be embodied in methods that include the actions of executing, for each of a plurality of rules, a corresponding script defining the rule, the rule being associated with a campaign management entity of an advertising campaign and defining an operation and a corresponding event, the event being the occurrence of a condition defined for the campaign management entity, and the operation being specifying an entity change for the associated campaign management entity, the execution of the script comprising: generating a first API call to an advertising service, the first API call for first entities corresponding to the campaign management entity and receiving a set of first entities response to the API call and storing the set of first entities in a local cache that is local to the data processing apparatus, processing an inst