title: Copy Play store report to personal Google Cloud Storage bucket
body: <p>I have a problem using Google Cloud Storage and Google Play reports. I'd like to parse reports on my server in PHP. To do that I'd like to move the file in the default app bucket to a new one. When I try to do that, I get the following error :</p>
  
  <pre><code>Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ "error": { "errors": [ { "domain": "global", "reason": "notFound", "message": "Not Found" } ], "code": 404, "message": "Not Found" } } ' in /var/www/d2/libs/googleAPI/src/Google/Http/REST.php:118 Stack trace: #0 /var/www/d2/libs/googleAPI/src/Google/Http/REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #2 /var/www/d2/libs/googleAPI/src/Google/Task/Runner.php(181): call_user_func_array(Array, Array) #3 /var/www/d2/libs/googleAPI/src/Google/Http/REST.php(58): Google_Task_Runner-&gt;run() #4 /var/www/d2/libs/googleAPI/src/Google/Client.php(781): Google_Http_REST::execute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...', Array) #5 /var/www/d2/libs/googleAPI/src/Google/Service in /var/www/d2/libs/googleAPI/src/Google/Http/REST.php on line 118
  </code></pre>
  
  <p>I don't know why because the destination bucket exists, origin file too.</p>
  
  <p>This is my implementation of my PHP script :</p>
  
  <pre><code>&lt;?php
  
  session_start();
  
  require_once dirname(__FILE__).'/../libs/googleAPI/vendor/autoload.php';
  
  $scopes = array("https://www.googleapis.com/auth/cloud-platform");
  
  // Create client object
  $client = new Google_Client(); 
  $client-&gt;setRedirectUri('http://CENSORED/TEST_API.php');
  $client-&gt;setAuthConfig("client_credentials_OAUTH.json");
  $client-&gt;addScope($scopes);
  
  if (isset($_SESSION['access_token']) &amp;&amp; $_SESSION['access_token'])
  {
      $client-&gt;setAccessToken($_SESSION['access_token']);
      $service = new Google_Service_Storage($client);
      $request = $service-&gt;objects-&gt;listObjects("statsinstalls");
      $objects = $request-&gt;getItems();
  
      $sourceBucket = "pubsite_prod_rev_CENSORED";
      $sourceObject = "installs_CENSORED_" . date("Ym") . "_app_version.csv";
      $destinationBucket = "statsinstalls";
      $destinationObject = $sourceObject;
  
      $postBody = new Google_Service_Storage_StorageObject($client);
  
      $response = $service-&gt;objects-&gt;copy($sourceBucket, $sourceObject, $destinationBucket, $destinationObject, $postBody);            
  
      foreach ($objects as $item)
          echo $item-&gt;id . "&lt;br&gt;";
  }
  else if (!isset($_GET['code']))
  {
      $auth_url = $client-&gt;createAuthUrl();
      header('Location: ' . filter_var($auth_url, FILTER_SANITIZE_URL));
  }
  else
  {
      $client-&gt;authenticate($_GET['code']);
      $_SESSION['access_token'] = $client-&gt;getAccessToken();
      $redirect_uri = 'http://CENSORED/TEST_API.php';
      header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL));
  }
  </code></pre>
  
  <p>Why I got a 404 error?
  Thanks.</p>