Setting Up a Client Library

The recommended way to use the Content API is through the Google API client libraries, which are available for many popular programming languages. This guide uses the Content API samples to demonstrate how to set up the Google API client library for Python to use with the Content API. In addition to the Content API sample files, you also need your service account credentials, which you can download from Merchant Center.

To set up the Google API client library for Python, complete the following steps:

  1. To download your service account credentials, complete the following steps:

    1. In Merchant Center, in the Settings menu, select Content API.
    2. Click Authentication.
    3. Click [+] CREATE API KEY.

    The new key downloads automatically.

  2. Rename the downloaded credentials file to service-account.json.

  3. Within your home directory, create the directories /shopping-samples/content/.

  4. Move the service-account.json file to your home directory/shopping-samples/content/.

  5. In your home directory/shopping-samples/content/, create an empty merchant-info.json file.

  6. In merchant-info.json, add the following text:

    {
    "merchantId": your account ID,
    "accountSampleUser": "your account email address"
    }
    
  7. Download (or clone) and unzip the googleads/googleads-shopping-samples GitHub repo.

  8. To install the required sample dependencies, in a new terminal window, navigate to googleads-shopping-samples-master/python/ and run:

    pip install -r requirements.txt
    

You now have the Google API client library for Python configured and ready to use with the Content API. In the next section, you’ll create and send a request to insert a new product.