This page shows how to programmatically create and update your data sources that let you insert products. Automated data sources make it easier to send your product data to Google. Automated data sources make sure that the most up-to-date information about relevant products from your website reach Google.
Content API for Shopping only lets you create primary data sources. With Merchant Data sources API, you can create the following types of data sources:
- Primary product data sources
- Supplemental product data sources
- Local inventory data sources
- Regional inventory data sources
- Promotion data sources
Content API for Shopping only allowed managing data sources with file input. Merchant API lets you manage data sources with both file and API inputs.
Using Merchant Data sources API, you can do the following:
- Create a new primary data source with a specific
feedLabel
andcontentLanguage
. - Create a wildcard data source. A wildcard data source doesn't have
feedLabel
andcontentLanguage
fields set. Wildcard data sources let you insert products with different combinations offeedLabel
andcontentLanguage
into a data source. - Create a supplemental data source to link to an existing primary data source.
- Set up a schedule for a file data source.
- Manage API data sources.
- Use other types of data sources like promotions.
Prerequisites
- Your account must have been migrated to single locale feeds.
To verify that the account is already migrated to data target split, use the data source list or get methods. In case you aren't eligible, you will receive the following exception message and you should contact support.
This account is in the data sources migration process and can't be used with this API yet. Contact support for more info on when this account will be able to use the data sources endpoint.
Create a new data source
To create a new primary data source with a specific feedLabel
and
contentLanguage
, set the feedLabel
and contentLanguage
fields in the
type-specific configuration. For example, PrimaryProductDataSource
.
To view your newly created data source, create a GET
or a LIST
request.
Create a new wildcard primary data source
To create a new wildcard primary feed, configure your data source using
PrimaryProductDataSource
and don't set the feedLabel
and contentLanguage
fields.
Using Content API for Shopping, there is only one API data source created for you. Using Merchant Data sources API, you can have multiple API data sources, some of which can be wildcard.
Only data sources with API input can be wildcard data sources. Wildcard data sources aren't supported for file inputs.
Create a supplemental data source and link it to the primary data source
You can use supplemental data sources to make partial updates to product data by
adding the unique identifier of the data source as a query parameter when making
calls to the
accounts.productInputs.insert
and
accounts.productInputs.delete
methods. You can only use supplemental data sources to update existing products.
To create a supplemental data source, configure your data source using
SupplementalProductDataSource
and then link it by updating the defaultRule
field on your primary data source.
Supplemental file data sources cannot be wildcard data sources. Supplemental API data sources must always be wildcard data sources.
Set up a schedule for your file data source
To set up a schedule for your file feed, configure your data source to be a file
data source by using the FileInput
field and then set up
fetchsettings
using the FileInput.FetchSettings
field.
Delete a data source
To delete an existing data source from your account, use the
accounts.dataSources.delete
method.
Fetch data source
To fetch a file configured in the data source, use the
accounts.dataSources.fetch
method. This method perform the data fetch immediately on a data source from
your account. This method only works on data sources with a file input set.
Get data source
To retrieve the data source configuration for your account, use the
accounts.dataSources.get
method.
List data source
To list the configurations for data sources for your account, use the
accounts.dataSources.list
method.
Patch data source
To update the configuration of an existing data source, use the
accounts.dataSources.patch
method.