OussamaOBO / gshoppingcontent-php

Automatically exported from code.google.com/p/gshoppingcontent-php
Other
0 stars 0 forks source link

GSC_Errors Object empty #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use an user that is not permitted / whitelisted for API Access yet  
2. Try to execute any Operation through the API
3. Dump result / GSC_Errors

What is the expected output? What do you see instead?

Would expect to see something in the errors-object related to the response xml

<errors 
xmlns='http://schemas.google.com/g/2005'><error><domain>sc</domain><code>auth/fr
ontend/whitelisted</code><location 
type='other'>request</location><internalReason>Customer XXXXXX has not been 
whitelisted for the Content API for Shopping.</internalReason></error></errors>

See an empty Object like: 
GSC_Errors Object
(
    [doc] => DOMDocument Object
        (
        )

    [model] => DOMElement Object
        (
        )

)

What version of the product are you using? On what operating system?
Debian Squeeze, php 5.3.10

Please provide any additional information below.

Original issue reported on code.google.com by a...@modula-shop-systems.de on 21 Mar 2012 at 1:27

GoogleCodeExporter commented 8 years ago
Alex,

The object is not empty, it is a custom class, and you can see its methods at:
http://gshoppingcontent-php.appspot.com/GShoppingContent/GSC_Errors.html

Here you'd want
$errorsFromResponse = .... do something ....
$errors = $errorsFromResponse->getErrors();

$firstError = $errors[0];
echo $firstError->getInternalReason();

If you'd like to view any object as XML you can execute:
echo $errorsFromResponse->toXML();
echo $firstError->toXML();

As for the error you got, see the error on our error code list:
https://developers.google.com/shopping-content/getting-started/error-codes#not-w
hitelisted

To get whitelisted, submit a request at:
http://support.google.com/merchants/bin/request.py?contact_type=content_api

Original comment by dhermes@google.com on 23 Apr 2012 at 10:02