gmail设置API中的域错误无效 [英] Invalid domain error in gmail setting api

查看:178
本文介绍了gmail设置API中的域错误无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用goggle admin sdk api在gmail帐户中创建一个标签。



我发送一个Http发送请求到

https://apps-apis.google.com/a/feeds/emailsettings/2.0/ {domain} / {username } / label /



但是我得到了这个回应:


$ b $

 无效的域名。 

错误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]/标签,
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>;


解决方案

如果您真的试图访问Gmail上的标签。您的域名管理员帐户中的com帐号无法使用。电子邮件设置API仅适用于Premier和Edu Google Apps域管理员。


I want to create a label in gmail account using goggle admin sdk api.

I am sending a Http Post Request to

https://apps-apis.google.com/a/feeds/emailsettings/2.0/{domain}/{username}/label/

But i get this response :-

Invalid domain.

Error 403

Following is the code for this task :-

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

解决方案

If you actually trying to access labels on your gmail.com account from your domain's admin account, it will not work. The email setting API works only on Premier and Edu Google Apps domains administrators.

这篇关于gmail设置API中的域错误无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆