Use the
aggregateProductStatuses.list
method in Merchant API to get a high-level overview of the status of products
in your Merchant Center account. This method lets you monitor the overall
health of your product data without fetching every individual product. It
returns total product counts broken down by status (active, expiring, pending,
and disapproved) and lists item-level issues affecting your products.
Special considerations
Keep the following considerations in mind when using
aggregateProductStatuses.list:
- Data availability: Expect a delay of more than 30 minutes between when
you insert or update a product and when the
aggregateProductStatusesresponse reflects the updated status. - Account types: Only standalone accounts and sub-accounts of an advanced
account can call this method. To retrieve aggregate product statuses for an
advanced account, first call
accounts.listSubaccountsto get its sub-accounts, then callaggregateProductStatuses.listfor each sub-account individually. - Expiring products (
expiringCount): TheexpiringCountfield counts active (eligible) products approaching expiration, not products that have already expired. An eligible product moves fromactiveCounttoexpiringCountat00:00:00 UTCon the calendar day that is 3 days (72 hours) before its effective expiration date, so products typically enterexpiringCount3 to 4 calendar days in UTC before they expire. For a given reporting context and country,activeCountandexpiringCountare mutually exclusive, andexpiringCountnever includes pending or disapproved products. - Aggregate counts only: The
aggregateProductStatuses.listmethod returns aggregate statistics and does not identify individual products. To identify individual products approaching expiration, query theproduct_viewtable usingreports.searchin the Reports sub-API and inspectexpiration_date(for example, by sorting eligible products withORDER BY expiration_date ASC). For details on queryingproduct_view, see Evaluate your products. - Issue consistency: The issue descriptions and details from
aggregateProductStatuses.listalign with those from the Products sub-API, though they might differ from the descriptions shown in the Merchant Center UI.
Get an overview of all product statuses
This example shows how to retrieve a list of
AggregateProductStatus
resources. Each resource represents the status of products for a specific
combination of reporting context and country. Calling
aggregateProductStatuses.list without a filter parameter returns all
available statuses for your account.
GET https://merchantapi.googleapis.com/issueresolution/v1/accounts/{ACCOUNT_ID}/aggregateProductStatuses
Here's a sample response from a successful call:
{
"aggregateProductStatuses": [
{
"name": "accounts/{ACCOUNT_ID}/aggregateProductStatuses/SHOPPING_ADS~US",
"reportingContext": "SHOPPING_ADS",
"country": "US",
"stats": {
"activeCount": "1500",
"pendingCount": "50",
"disapprovedCount": "25",
"expiringCount": "12"
},
"itemLevelIssues": [
{
"code": "item_missing_required_attribute",
"severity": "DISAPPROVED",
"resolution": "MERCHANT_ACTION",
"attribute": "n:image_link",
"description": "Missing product image",
"detail": "Add an image so customers can easily identify your product",
"documentationUri": "https://support.google.com/merchants/answer/12158124",
"productCount": "15"
},
{
"code": "invalid_price",
"severity": "DISAPPROVED",
"resolution": "MERCHANT_ACTION",
"attribute": "n:price",
"description": "Invalid price format [price]",
"detail": "Use a valid price format such as \"1.00 EUR\" (ISO 4217)",
"documentationUri": "https://support.google.com/merchants/answer/6324371",
"productCount": "10"
}
]
},
{
"name": "accounts/{ACCOUNT_ID}/aggregateProductStatuses/FREE_LISTINGS~US",
"reportingContext": "FREE_LISTINGS",
"country": "US",
"stats": {
"activeCount": "1510",
"pendingCount": "50",
"disapprovedCount": "15",
"expiringCount": "12"
},
"itemLevelIssues": [
{
"code": "item_missing_required_attribute",
"severity": "DISAPPROVED",
"resolution": "MERCHANT_ACTION",
"attribute": "n:image_link",
"description": "Missing product image",
"detail": "Add an image so customers can easily identify your product",
"documentationUri": "https://support.google.com/merchants/answer/12158124",
"productCount": "15"
}
]
}
]
}
Get product statuses for a specific country and reporting context
Filter results for a specific country and reporting context by using the
filter query parameter with aggregateProductStatuses.list. Filtering
supports only the country and reportingContext fields with the = and !=
operators, combined with AND or parenthesized OR expressions. For example:
country = "US" AND reportingContext = "SHOPPING_ADS". For more details on
general filter syntax, see
Filter syntax.
GET https://merchantapi.googleapis.com/issueresolution/v1/accounts/{ACCOUNT_ID}/aggregateProductStatuses?filter=country%3D%22US%22%20AND%20reportingContext%3D%22SHOPPING_ADS%22
Here's a sample response from a successful call:
{
"aggregateProductStatuses": [
{
"name": "accounts/{ACCOUNT_ID}/aggregateProductStatuses/SHOPPING_ADS~US",
"reportingContext": "SHOPPING_ADS",
"country": "US",
"stats": {
"activeCount": "1500",
"pendingCount": "50",
"disapprovedCount": "25",
"expiringCount": "12"
},
"itemLevelIssues": [
{
"code": "item_missing_required_attribute",
"severity": "DISAPPROVED",
"resolution": "MERCHANT_ACTION",
"attribute": "n:image_link",
"description": "Missing product image",
"detail": "Add an image so customers can easily identify your product",
"documentationUri": "https://support.google.com/merchants/answer/12158124",
"productCount": "15"
},
{
"code": "invalid_price",
"severity": "DISAPPROVED",
"resolution": "MERCHANT_ACTION",
"attribute": "n:price",
"description": "Invalid price format [price]",
"detail": "Use a valid price format such as \"1.00 EUR\" (ISO 4217)",
"documentationUri": "https://support.google.com/merchants/answer/6324371",
"productCount": "10"
}
]
}
]
}
Code samples
The following code samples show how to list aggregate product statuses with a country filter:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.issueresolution.v1.AggregateProductStatus;
import com.google.shopping.merchant.issueresolution.v1.AggregateProductStatusesServiceClient;
import com.google.shopping.merchant.issueresolution.v1.AggregateProductStatusesServiceClient.ListAggregateProductStatusesPagedResponse;
import com.google.shopping.merchant.issueresolution.v1.AggregateProductStatusesServiceSettings;
import com.google.shopping.merchant.issueresolution.v1.ListAggregateProductStatusesRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/**
* This class demonstrates how to list all the accounts the user making the request has access to.
*/
public class ListAggregateProductStatusesSample {
public static void listAggregateProductStatuses(Config config) throws Exception {
// Obtains OAuth token based on the user's configuration.
GoogleCredentials credential = new Authenticator().authenticate();
// Creates service settings using the credentials retrieved above.
AggregateProductStatusesServiceSettings aggregateProductStatusesServiceSettings =
AggregateProductStatusesServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Calls the API and catches and prints any network failures/errors.
try (AggregateProductStatusesServiceClient aggregateProductStatusesServiceClient =
AggregateProductStatusesServiceClient.create(aggregateProductStatusesServiceSettings)) {
// Gets the account ID from the config file.
String accountId = config.getAccountId().toString();
// Creates account name to identify account.
String accountName = AccountName.newBuilder().setAccount(accountId).build().toString();
ListAggregateProductStatusesRequest request =
ListAggregateProductStatusesRequest.newBuilder()
.setParent(accountName)
.setFilter("country = \"US\"") // Optionally set a filter.
.build();
System.out.println("Sending list aggregate product statuses request");
ListAggregateProductStatusesPagedResponse response =
aggregateProductStatusesServiceClient.listAggregateProductStatuses(request);
int count = 0;
// Iterates over all rows in all pages and prints the datasource in each row.
// Automatically uses the `nextPageToken` if returned to fetch all pages of data.
for (AggregateProductStatus aggregateProductStatus : response.iterateAll()) {
System.out.println("Printing response:");
System.out.println(aggregateProductStatus);
count++;
}
System.out.print("The following count of aggregate product statuses were returned: ");
System.out.println(count);
} catch (Exception e) {
System.out.println("An error has occured: ");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listAggregateProductStatuses(config);
}
}
C#
using System;
using static MerchantApi.Authenticator;
using Google.Api.Gax;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Auth.OAuth2.Flows;
using Google.Apis.Auth.OAuth2.Responses;
using Google.Apis.Http;
using Newtonsoft.Json;
using Google.Shopping.Merchant.IssueResolution.V1;
namespace MerchantApi
{
/// <summary>
/// This class demonstrates how to list aggregate product statuses.
/// </summary>
public class ListAggregateProductStatusesSample
{
public static void ListAggregateProductStatuses()
{
// Authenticate using either oAuth or service account
ICredential auth = Authenticator.Authenticate(
MerchantConfig.Load(),
// Passing the default scope for Merchant API: https://www.googleapis.com/auth/content
AggregateProductStatusesServiceClient.DefaultScopes[0]);
// Creates the service client.
var client = new AggregateProductStatusesServiceClientBuilder
{
Credential = auth
}.Build();
// Calls the API and catches and prints any network failures/errors.
try
{
var request = new ListAggregateProductStatusesRequest
{
// The parent resource for the request.
ParentAsAccountName = AccountName.FromAccount(MerchantConfig.Load().MerchantId.ToString()),
Filter = "country = \"US\"" // Optionally set a filter.
};
Console.WriteLine("Sending list aggregate product statuses request");
PagedEnumerable<ListAggregateProductStatusesResponse, AggregateProductStatus> response =
client.ListAggregateProductStatuses(request);
int count = 0;
// Iterates over all rows in all pages and prints the datasource in each row.
// Automatically uses the `nextPageToken` if returned to fetch all pages of data.
foreach (var aggregateProductStatus in response)
{
Console.WriteLine("Printing response:");
Console.WriteLine(aggregateProductStatus);
count++;
}
Console.Write("The following count of aggregate product statuses were returned: ");
Console.WriteLine(count);
}
catch (Exception e)
{
Console.WriteLine("An error has occurred:");
Console.WriteLine(e);
}
}
public static void Main(string[] args)
{
ListAggregateProductStatuses();
}
}
}