phiture / searchads_api

Apple Search Ads API non-official python library
MIT License
49 stars 13 forks source link
api api-library apple applesearchads asa campaign library management python searchads

Phiture

About Phiture

Phiture is a Berlin-based mobile growth consultancy working with the teams behind leading apps. Using the company’s industry-acclaimed Mobile Growth Stack as a strategic framework, Phiture team offers 4 key services: App Store Optimization, Apple Search Ads, User Retention services and Growth Consulting.

Apple Searchads API Library in Python

In order to facilitate the usage of the Apple Search Ads API Phiture's Engineers have built a library in Python which allows users to manage campaigns, ad groups, keywords and creative sets. This library only requires intermediate Python skills and therefore makes it possible not only for Engineers but also for Data Analysts and Apple Search Ads Consultants to work with it. While the library is extensive it is not complete and users are encouraged to commit suggestions. The official link to the searchads campaign management api is https://developer.apple.com/documentation/search_ads/

Setup

Using cert and key files

Create a certs directory inside of your project folder, or create a different certs directory and specify it using the certificates_dir_path argument.

PEM_FILE_PATH = "cert.pem"
KEY_FILE_PATH = "cert.key"
CERTIFICATES_DIR_PATH = "certs/"

api = SearchAdsAPI(
    org_id=123456,
    pem=PEM_FILE_PATH,
    key=KEY_FILE_PATH,
    certificates_dir_path=CERTIFICATES_DIR_PATH,
    client_id="SEARCHADS.12345678-1234-1234-1234-123456789012",
    team_id="SEARCHADS.12345678-1234-1234-1234-123456789012",
    key_id="12345678-1234-1234-1234-123456789012",
)

Using cert and key file strings

PEM_FILE_CONTENT = """
-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----
"""

KEY_FILE_CONTENT = """
-----BEGIN EC PRIVATE KEY-----
...
-----END EC PRIVATE KEY-----
"""

api = SearchAdsAPI(
    org_id=123456,
    pem_content=PEM_FILE_CONTENT,
    key_content=KEY_FILE_CONTENT,
    client_id="SEARCHADS.12345678-1234-1234-1234-123456789012",
    team_id="SEARCHADS.12345678-1234-1234-1234-123456789012",
    key_id="12345678-1234-1234-1234-123456789012",
)

Available Methods

Campaign Methods

Adgroup Methods

Targeting Keyword Methods

Campaign Negative Keyword Methods

Adgroup Negative Keyword Methods

Creativeset Methods (Some methods are Deprecated since ASA v4)

Reporting Methods

Geo Search

Ad Endpoints

Product Pages methods

Impression share reports

Changelog