列出所有帐户时出现错误未知参数:“视图”

我正在尝试在整个内容API中列出我们CSS中心中的所有商家。该文档指出,要列出CSS帐户(内容API V2.1)中的所有商家,而不是在MCA中列出帐户,则需要包含参数view = css。

当我尝试通过内容API(PHP客户端)执行此操作时,收到错误消息:

(列表)未知参数:“视图”

我们用来获取商家的代码是:

$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"));

我似乎找不到通过PHP中的内容API包含参数视图的方式。该文档还指出View应该是一个ENUM,但是我不太确定如何使用它。

指向accounts.list

的文档链接
iCMS 回答:列出所有帐户时出现错误未知参数:“视图”

Content API PHP客户端似乎没有在accounts.list函数中添加参数view = css。

要使其正常工作,您必须在整个客户端中进行手动HTTP调用:

$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());
本文链接:https://www.f2er.com/1649788.html

大家都在问