Oki ive managed to get as far as to sending a request like this:
[code]
@Override
public void run() {
namespaceDictionary = namespaceDictionary
.set("", "
http://www.w3.org/2005/Atom")
.set("app", "
http://www.w3.org/2007/app")
.set("gd", "
http://schemas.google.com/g/2005")
// Try: for data quality maybe just insert
https://content.googleapis.com/content/v1/54321/dataquality/98765 .set("sc", "
http://schemas.google.com/structuredcontent/2009")
.set("scp", "
http://schemas.google.com/structuredcontent/2009/products")
.set("xml", "
http://www.w3.org/XML/1998/namespace");
errorNamespaceDictionary = errorNamespaceDictionary.set("", "
http://schemas.google.com/g/2005");
try {
// create new transport
HttpTransport transport = new NetHttpTransport();
// ClientLogin
ClientLogin authenticator = new ClientLogin();
authenticator.transport = transport;
authenticator.authTokenType = "structuredcontent";
authenticator.username = "
so...@email.de";
authenticator.password = "somepassword";
final ClientLogin.Response response = authenticator.authenticate();
// create request factory
httpRequestFactory = authenticator.transport.createRequestFactory(new HttpRequestInitializer() {
@Override
public void initialize(HttpRequest request) {
HttpHeaders headers = new HttpHeaders();
// authorize using clientLogin
headers.setAuthorization(response.auth);
request.setHeaders(headers);
request.setParser(new XmlObjectParser(namespaceDictionary));
response.initialize(request);
}
});
List<Product> products = getProducts();
for(Product product : products) {
System.out.println(
product.name);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static List<Product> getProducts() throws IOException, HttpResponseException {
String url = ROOT_URL + "322-413-9894" + "/items/products/schema"; // also tried the account id like this -> "3224139894"
HttpRequest request = httpRequestFactory.buildGetRequest(new GenericUrl(url));
ProductFeed feed = request.execute().parseAs(ProductFeed.class);
return feed.entries;
}
[/code]
The Problem now is that i get a "com.google.api.client.http.HttpResponseException: 403 Forbidden" or a "" saying that either error "<internalReason>Unknown customer-id in URL:" for 3224139894 or a 400 Bad Request "<location type='other'>customer-id</location><internalReason>Invalid customer id in URL</internalReason>" for 322-413-9894
Isnt the account id the customer id?
greetings