I'm trying to list all the merchants in our CSS center throughout the content API. The documentation states that you need to include the parameter view=css when you want to list all the merchants in your CSS account (content API V2.1), instead of listing the accounts in an MCA.
When I try to do this through the content API (PHP client), I get the error message:
(list) unknown parameter: 'view'
The code we use to get the merchants is:
$client = new Google_Client();
// client instantiation logic not included here
$service = new Google_Service_ShoppingContent($client);
// $mca_id = our CSS ID
$merchants = $service->accounts->listAccounts($mca_id, array("maxResults" => 100, "view" => "css"));
I can't seem to find how I need to include the parameter view through the content API in PHP. The documentation also states that the View should be an ENUM, but I'm not quite sure how to use this.
Documentation link to the accounts.list
The Content API PHP client doesn't seem to have the parameter view=css added in the accounts.list function.
To get this working you have to do a manual HTTP call throughout the client:
$client = new Google_Client();
// client instantiation logic not included here
// returns a Guzzle HTTP Client
$httpClient = $client->authorize();
// $mca_id = our CSS ID
$merchants = json_decode($httpClient->get('https://www.googleapis.com/content/v2.1/' . $mca_id . '/accounts?maxResults=100&view=CSS')->getBody()->getContents());