Content API for Shopping

Managing Client Accounts

Merchant Center multi-client accounts allow a single person or company to submit data feeds for multiple domains. Each client may have a distinct store name and URL. See the Set up a multi-client account Help Center article for more information.

The following sections describe how to create, retrieve, update and delete client accounts. If you have a multi-client account, you can list, create, update, and delete your subaccounts.

Contents

  1. Client Account Attributes
  2. Creating a Client Account
  3. Retrieving Client Accounts
  4. Updating a Client Account
  5. Deleting a Client Account

Client Account Attributes

In the GData representation of the account, supply the data described in the following table.

Attribute Required Description
<title> yes display name for the account
<content> no description of the client
<link> with rel="alternate" no the client's website
<sc:adult_content> yes indicates whether the client sells adult content
<sc:internal_id> no client-specific, locally-unique, internal id for the child account, also known as a seller id or seller name
<sc:reviews_url> no url for individual seller reviews, i.e., reviews for each child account
<sc:adwords_accounts> no list of AdWords accounts. See AdWords Accounts.

AdWords Accounts

If you insert or update an account that is associated with a set of AdWords accounts, you must describe the AdWords account information using a list of <sc:adwords_account> elements.

Each <sc:adwords_account> element contains the AdWords account ID as it's value and also the status of the account as an attribute. The status can be one of the two strings "active" or "inactive". For example:

<sc:adwords_accounts>
  <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
  <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
</sc:adwords_accounts>

Creating a Client Account

To create, or insert, a client account, send an HTTP POST request to your managedaccounts feed URL. The body of your request is an XML document in the format shown below:

POST  /content/v1/MULTI_CLIENT_ACCOUNT_ID/managedaccounts HTTP/1.1
Host: content.googleapis.com
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=AUTHORIZATION_TOKEN

<?xml version='1.0'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:sc='http://schemas.google.com/structuredcontent/2009'>
  <title type='text'>ABC Store</title>
  <content type='text'>Description of ABC Store</content>
  <link rel='alternate' type='text/html' href='http://abcstore.example.com'/>
  <sc:adult_content>no</sc:adult_content>
  <sc:internal_id>af437</sc:internal_id>
  <sc:reviews_url>http://my.site.com/reviews?mo=user-rating&amp;user=af437</sc:reviews_url>
  <sc:adwords_accounts>
    <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
    <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
  </sc:adwords_accounts>
</entry>

If Google successfully handles your request to create a client account, the API will return a 201 HTTP response code. The body of the API response will be an Atom entry that describes the newly created account as shown in the sample below. In the sample, the parent account ID is 123456 and the sub-account 78901. Information added by the server to the request is shown in bold text.

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:sc='http://schemas.google.com/structuredcontent/2009'
    xmlns:gd='http://schemas.google.com/g/2005'>
  <id>http://content.googleapis.com/content/account/78901</id>
  <published>2010-06-15T22:26:32.967Z</published>
  <updated>2010-07-15T22:26:38.397Z</updated>
  <app:edited>2010-07-23T14:36:24.315Z</app:edited>
  <title type='text'>ABC Store</title>
  <content type='text'>Description of ABC Store</content>
  <link rel='alternate' type='text/html' href='http://abcstore.example.com'/>
  <link rel='self' type='application/atom+xml'
      href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
  <link rel='edit' type='application/atom+xml'
      href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
  <sc:account_status>active</sc:account_status>
  <sc:adult_content>no<sc:adult_content>
  <sc:internal_id>af437</sc:internal_id>
  <sc:reviews_url>http://my.site.com/reviews?mo=user-rating&amp;user=af437</sc:reviews_url>
  <sc:adwords_accounts>
    <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
    <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
  </sc:adwords_accounts>
</entry>

Retrieving Client Accounts

You can retrieve information related to a single client account or a list of all of your client accounts.

Single Account

To retrieve information related to a single client account, send an HTTP GET request to that account's unique URL, as shown in the following sample request:

GET /content/v1/MULTI_CLIENT_ACCOUNT_ID/managedaccounts/SUB_ACCOUNT_ID
Host: content.googleapis.com
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=AUTHORIZATION_TOKEN

List of All Client Accounts

To retrieve a list of your client accounts, send an HTTP GET request to your managedaccounts feed URL, as shown in the following sample request:

GET /content/v1/MULTI_CLIENT_ACCOUNT_ID/managedaccounts
Host: content.googleapis.com
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=AUTHORIZATION_TOKEN

If Google successfully handles your request to retrieve a list of client accounts, the API will return a 200 HTTP response code. The body of the API response will be an Atom feed in which each entry identifies one of your client accounts.

The XML feed below shows a sample response that lists one client account:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:sc='http://schemas.google.com/structuredcontent/2009'
    xmlns:gd='http://schemas.google.com/g/2005'
    xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'>
  <id>http://content.googleapis.com/content/v1/123456/managedaccounts</id>
  <updated>2010-12-15T16:10:35.279Z</updated>
  <title>Managed accounts for aggregator Super Aggregator</title>
  <link rel="alternate" type="text/html" href="http://base.google.com"/>
  <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"
      href="https://content.googleapis.com/content/v1/123456/managedaccounts"/>
  <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml"
      href="https://content.googleapis.com/content/v1/123456/managedaccounts"/>
  <link rel="self" type="application/atom+xml"
      href="https://content.googleapis.com/content/v1/123456/managedaccounts"/>
  <openSearch:totalResults>1</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <entry>
    <id>http://content.googleapis.com/content/account/78901</id>
    <published>2010-06-15T22:26:32.967Z</published>
    <updated>2010-07-15T22:26:38.397Z</updated>
    <app:edited>2010-07-23T14:36:24.315Z</app:edited>
    <title type='text'>ABC Store</title>
    <content type='text'>Description of ABC Store</content>
    <link rel='alternate' type='text/html' href='http://abcstore.example.com'/>
    <link rel='self' type='application/atom+xml'
        href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
    <link rel='edit' type='application/atom+xml'
        href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
    <sc:account_status>active</sc:account_status>
    <sc:adult_content>no<sc:adult_content>
    <sc:internal_id>af437</sc:internal_id>
    <sc:reviews_url>http://my.site.com/reviews?mo=user-rating&amp;user=af437</sc:reviews_url>
    <sc:adwords_accounts>
      <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
      <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
    </sc:adwords_accounts>
  </entry>
</feed>

Note: In the case that a given Client account has no associated AdWords accounts, an empty <sc:adwords_accounts> element will be returned with the Client account <entry>.

Paging through Results

By default, API responses contain up to 25 entries when you retrieve a list of client accounts. For more than 25 entries, you can paginate through the results by specifying the start-index (first client account to return) and max-results (total number of client accounts to return–max value is 100) URL parameters. If you have more than 25 client accounts, then when you retrieve your client accounts feed, the <feed> tag contains a <link> tag that has the URL for the next page of up to 25 client accounts.

The XML snippet below shows the <link> tags that would appear within the <feed> tag. The example is for a feed aggregator (Account ID 123456) who has 100 client accounts and has just retrieved the second page of 25 accounts.

<link rel='alternate' type='text/html' href='https://content.googleapis.com'/>
<link rel='http://schemas.google.com/structuredcontent/2009#feed' type='application/atom+xml'
  href='https://content.googleapis.com/content/v1/123456/managedaccounts'>
<link rel='http://schemas.google.com/structuredcontent/2009#post' type='application/atom+xml'
  href='https://content.googleapis.com/content/v1/123456/managedaccounts'>
<link rel='self' type='application/atom+xml'
  href='https://content.googleapis.com/content/v1/123456/managedaccounts'>
<link rel='next' type='application/atom+xml'
  href='https://content.googleapis.com/content/v1/123456/managedaccounts?start-index=51&amp;max-results=25'/>
<link rel='previous' type='application/atom+xml'
  href='https://content.googleapis.com/content/v1/123456/managedaccounts?start-index=1&amp;max-results=25'/>
...

<openSearch:itemsPerPage>25</openSearch:itemsPerPage>

Updating a Client Account

To update a client account, send an HTTP PUT request to the edit URL for the account. The body of the API request will be an XML document that has the same format as the XML that you would send to create a client account.

Note: You must specify values for the <title> and <sc:adult_content> tags even if the values specify the same title and adult content setting.

The following shows a sample request to update a client account:

PUT /content/v1/MULTI_CLIENT_ACCOUNT_ID/managedaccounts/SUB_ACCOUNT_ID HTTP/1.1
Host: content.googleapis.com
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=AUTHORIZATION_TOKEN

<?xml version='1.0'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:sc='http://schemas.google.com/structuredcontent/2009'>
  <title type='text'>ABCD Store</title>
  <content type='text'>Description of ABCD Store</content>
  <link rel='alternate' type='text/html' href='http://abcdstore.example.com'/>
  <sc:adult_content>no</sc:adult_content>
  <sc:internal_id>437</sc:internal_id>
  <sc:reviews_url>http://my.site.com/reviews?mo=user-rating&amp;user=437</sc:reviews_url>
  <sc:adwords_accounts>
    <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
    <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
  </sc:adwords_accounts>
</entry>

If Google successfully handles your request to update a client account, the API will return a 200 HTTP response code. The body of the API response will be an Atom entry that describes the newly updated client account as shown in the sample below. In the sample, Multi-Client account 123456 updates sub-account 78901.

<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
    xmlns:app='http://www.w3.org/2007/app'
    xmlns:sc='http://schemas.google.com/structuredcontent/2009'
    xmlns:gd='http://schemas.google.com/g/2005'>
  <id>http://content.googleapis.com/content/account/78901</id>
  <published>2010-07-15T22:26:32.967Z</published>
  <updated>2010-07-15T22:26:38.397Z</updated>
  <app:edited>2010-07-23T15:04:07.370Z</app:edited>
  <title>ABCD Store</title>
  <content>Description of ABCD Store</content>
  <link rel='alternate' type='text/html' href='http://abcdstore.example.com'/>
  <link rel='self' type='application/atom+xml'
      href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
  <link rel='edit' type='application/atom+xml'
      href='https://content.googleapis.com/content/v1/123456/managedaccounts/78901'/>
  <sc:account_status>active</sc:account_status>
  <sc:adult_content>no</sc:adult_content>
  <sc:internal_id>437</sc:internal_id>
  <sc:reviews_url>http://my.site.com/reviews?mo=user-rating&amp;user=437</sc:reviews_url>
  <sc:adwords_accounts>
    <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
    <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
  </sc:adwords_accounts>
</entry>

Updating AdWords Accounts

If the <sc:adwords_accounts> element is not included in an update request, the existing associated AdWords accounts settings will be unchanged and returned with the response.

As long as <sc:adwords_accounts> is included in the request, the values contained are interpreted as the complete settings. For example, if your account was previously associated with the active AdWords account 222-333-4444 by including

<sc:adwords_accounts>
  <sc:adwords_account status="active">222-333-4444</sc:adwords_account>
</sc:adwords_accounts>

and you submit an update containing

<sc:adwords_accounts>
  <sc:adwords_account status="active">123-456-7890</sc:adwords_account>
  <sc:adwords_account status="inactive">234-567-8901</sc:adwords_account>
</sc:adwords_accounts>

then the association with 222-333-4444 will be removed.

If you would like to remove all associated AdWords accounts, submit an update with an empty <sc:adwords_accounts/> element.

Deleting a Client Account

To delete a client account, send an HTTP DELETE request to the edit URL for the account.

When you delete a client account, all of the items in that client's feeds will be removed from the Google search index in approximately one day. The following sample API request demonstrates how to delete a client account:

DELETE /content/v1/MULTI_CLIENT_ACCOUNT_ID/managedaccounts/SUB_ACCOUNT_ID HTTP/1.1
Host: content.googleapis.com
Content-Type: application/atom+xml
Authorization: GoogleLogin auth=AUTHORIZATION_TOKEN

If Google successfully handles your request to delete a client account, the API will return a 200 HTTP response code. The body of the response will be empty.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.