Hi there,
I am frequently encountering errors when attempting to get a list of accounts under a merchant ID in the Google Shopping API. I am using the Java API. I frequently encounter a
Read timed out socket error when attempting to call:
ShoppingContent content = ...;
content.accounts().list(merchantID).execute();
It is a bit unclear on how to increase the Read timeout, or what it should be. I have tried setting an HttpInitializer on the Credential passed in when creating the ShoppingContent as so:
var jsonFactory = JacksonFactory.getDefaultInstance();
var httpTransport = GoogleNetHttpTransport.newTrustedTransport();
var httpRequestInitializer = new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
request.setConnectTimeout(60000);
request.setReadTimeout(10 * 60000);
}
};
var credential = new GoogleCredential.Builder()
.setClientSecrets("secret", "secret")
.setJsonFactory(jsonFactory)
.setTransport(httpTransport)
.setRequestInitializer(httpRequestInitializer)
.build()
.setRefreshToken("refreshToken");
var oauth2 = new Oauth2.Builder(httpTransport, jsonFactory, credential).build();
var userinfo = oauth2.userinfo().get().execute();
var content = new ShoppingContent.Builder(httpTransport, jsonFactory, credential)
.build();
However this does not seem to work, and it still continues to time out after approximately 60 seconds. Any help would be appreciated.