title: Google email audit API Admin SDK
body: <p>Im going to list my user's email using the <strong>email audit API</strong> for user abc.so far my code is</p>
  
  <pre><code>$xml = "
      &lt;atom:entry xmlns:atom='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'&gt;
     &lt;apps:property name='destUserName' value='abc'/&gt;
     &lt;apps:property name='beginDate' value='2009-06-15 00:00'/&gt;
     &lt;apps:property name='endDate' value='2015-06-30 23:20'/&gt;
     &lt;apps:property name='incomingEmailMonitorLevel' value='FULL_MESSAGE'/&gt;
     &lt;apps:property name='outgoingEmailMonitorLevel' value='HEADER_ONLY'/&gt;
     &lt;apps:property name='draftMonitorLevel' value='FULL_MESSAGE'/&gt;
     &lt;apps:property name='chatMonitorLevel' value='FULL_MESSAGE'/&gt;
  &lt;/atom:entry&gt;
  ";
  
  
  $abc = 'mypublicAPI';
  $cred = new Google_Auth_AssertionCredentials(
    'myEmail',
    array(
        'https://apps-apis.google.com/a/feeds/compliance/audit',
      ),$abc
  );
  
  
  $client-&gt;setAssertionCredentials($cred);
  $domain = 'mydomain';
  $username = 'abc';
  if($client-&gt;getAuth()-&gt;isAccessTokenExpired()) {
      $client-&gt;getAuth()-&gt;refreshTokenWithAssertion($cred);
  }
  $url = "https://apps-apis.google.com/a/feeds/compliance/audit/mail/monitor/" . $domain .'/'. $username;                                                        
  $req = new Google_Http_Request($url, 'POST');
  $req-&gt;setPostBody($xml);
  
  $token = json_decode($client-&gt;getAccessToken(), true);
  
  $req-&gt;setRequestHeaders(
      array(
          'Content-Type'=&gt; 'application/atom+xml; charset=utf-8',
          'Authorization'=&gt; 'Bearer ' . $token['access_token'] . '',
      )
  );
  </code></pre>
  
  <p>however the code returns nothing. not even a http status code like the documetation says:
  <a href="https://developers.google.com/admin-sdk/email-audit/#creating_a_new_email_monitor" rel="nofollow">https://developers.google.com/admin-sdk/email-audit/#creating_a_new_email_monitor</a></p>
  
  <p>however, when i do </p>
  
  <pre><code>var_dump($req);
  </code></pre>
  
  <p>the code returns</p>
  
  <pre><code>object(Google_Http_Request)#52 (14) { ["batchHeaders":"Google_Http_Request":private]=&gt; array(3) { ["Content-Type"]=&gt; string(16) "application/http" ["Content-Transfer-Encoding"]=&gt; string(6) "binary" ["MIME-Version"]=&gt; string(3) "1.0" } ["queryParams":protected]=&gt; array(0) { } ["requestMethod":protected]=&gt; string(4) "POST" ["requestHeaders":protected]=&gt; array(2) { ["content-type"]=&gt; string(35) "application/atom+xml; charset=utf-8" ["authorization"]=&gt; string(90) "Bearer ya29.tAC7zkWiQjV_KcSSQZhmUQGuXgXvN9LMVBERhflX2vs4qsfGGVQoBRIHSLGawsLLxYNPaZuqQgtKug" } ["baseComponent":protected]=&gt; string(28) "https://apps-apis.google.com" ["path":protected]=&gt; string(85) "/a/feeds/compliance/audit/mail/monitor/mydomain/abc" ["postBody":protected]=&gt; string(597) " " ["userAgent":protected]=&gt; NULL ["canGzip":protected]=&gt; NULL ["responseHttpCode":protected]=&gt; NULL ["responseHeaders":protected]=&gt; NULL ["responseBody":protected]=&gt; NULL ["expectedClass":protected]=&gt; NULL ["accessKey"]=&gt; NULL }
  </code></pre>
  
  <p>any help??</p>