我想使用goggle admin sdk api在gmail帐户中创建一个标签。
我发送了一个Http Post Request
https://apps-apis.google.com/a/feeds/emailsettings/2.0/ {域} / {名} /标签/
但我得到了这样的答复: -
Invalid domain.
Error 403
以下是此任务的代码: -
$domain = explode('@',$user->email);
$headers = array(
"X-HTTP-Method-Override: POST",
"Authorization: {$obj->token_type} "." {$obj->access_token}",
"Content-type: application/atom+xml",
);
$options = array(CURLOPT_URL => "https://apps-apis.google.com/a/feeds/emailsettings/2.0/$domain[1]/$domain[0]/label",
CURLOPT_HEADER => 1,
CURLOPT_RETURNTRANSFER => 1,
// CURLOPT_USERAGENT => '',
CURLOPT_FOLLOWLOCATION => 1,
// CURLOPT_VERBOSE => 1,
// CURLOPT_POST => true
);
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo "<pre>";print_r($result);echo"</pre>";
答案 0 :(得分:0)
如果您确实尝试从域管理员帐户访问gmail.com帐户上的标签,则无法使用。电子邮件设置API仅适用于Premier和Edu Google Apps域管理员。