title: google drive api export
body: <p>I am new to google api. My goal is to upload a document (doc, docx) from a server to google drive without any client approval process. Once it is uploaded i wanted to export it as a pdf file.</p>
  
  <p>I created a service account. Uploading itself works fine. Able to download the uploaded document. When i tried to export the document from the drive i am getting the following error.</p>
  
  <pre><code>{
    "error": {
      "errors": [
        {
          "domain": "global",
          "reason": "badRequest",
          "message": "ExportonlysupportsGoogleDocs."
        }
      ],
      "code": 400,
      "message": "ExportonlysupportsGoogleDocs."
    }
  }
  </code></pre>
  
  <p>i use the google drive api v2 php library. Here is the code i used for the export. </p>
  
  <pre><code>    $tempUrl = "https://www.googleapis.com/drive/v2/files/xxxx/export?mimeType=application%2Fpdf";
      $request = new Google_Http_Request($tempUrl, 'GET', null, null);
      $httpRequest = $service-&gt;getClient()-&gt;getAuth()-&gt;authenticatedRequest($request);
  
      if ($httpRequest-&gt;getResponseHttpCode() == 200) {
        $newFile = 'downLoaded.pdf';
        file_put_contents($newFile, $httpRequest-&gt;getResponseBody());
      } else {
        var_dump($httpRequest-&gt;getResponseBody());
      }
  </code></pre>
  
  <p>Is it not possible to export from google drive? What does 'ExportonlysupportsGoogleDocs.' means? What am i missing?</p>
  
  <p>Thank you for your interest and any comment is appreciated.</p>