tvt2410 / google-api-php-client

Automatically exported from code.google.com/p/google-api-php-client
Apache License 2.0
0 stars 0 forks source link

DailyUploads how to upload file? Keep getting (400) Upload request url should start with #238

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. authenticated
2. calling Google_ManagementDailyUploadsServiceResource upload method
$dailyUploadsFile = $service->management_dailyUploads->upload('34712363', 
'UA-34712363-1', 'omxiqiFqQUuKLx21E86vWA', '2012-12-28', 1, 'cost');
3. Get error: (400) Upload request url should start with 
https://www.googleapis.com/upload/analytics/...'

What is the expected output? What do you see instead?
Want to pass csv file together with the rest of parameters so date gets 
uploaded to GA.
Tried passing array with additional parameters and csv file content, file name 
and other things, but nothing works. Need example of how to use daily uploads 
upload method.

What version of the product are you using? On what operating system?
google-api-php-client-0.6.0.tar.gz
Google_AnalyticsService.php rs510

Please provide any additional information below.
Attached my csv file.

Help will be greatly appreciated, because I've been completely stuck for a few 
days already not knowing how to pass the file to daily uploads or where the 
problem is.

Original issue reported on code.google.com by ruta.gre...@gmail.com on 31 Dec 2012 at 8:54

Attachments:

GoogleCodeExporter commented 9 years ago
i have the same problem

Original comment by tdobrano...@adviso.ca on 11 Jan 2013 at 4:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
$dailyUploadsFile = $service->management_dailyUploads->upload('34712363', 
'UA-34712363-1', 'omxiqiFqQUuKLx21E86vWA', '2012-12-28', 1, 'cost', 
array("reset" => true, "data" => file_get_contents("costdata.csv"), 'mimeType' 
=> 'application/octet-stream', 'uploadType' => 'media'));

Original comment by miro.mat...@markopolo.sk on 14 Jan 2013 at 9:20

GoogleCodeExporter commented 9 years ago
Thank you so much! Works perfectly.

Original comment by Ruta.Bum...@gmail.com on 16 Jan 2013 at 7:19

GoogleCodeExporter commented 9 years ago
Sorry, posted with different profile. So thank you again, definitely helped 
with my issue.

Original comment by ruta.gre...@gmail.com on 16 Jan 2013 at 7:22

GoogleCodeExporter commented 9 years ago
I'm struggling with this code. I'm passing the variables to this via a web 
form. When I run the code I get

Fatal error: Call to a member function upload() on a non-object in

Can anyone help with this?

Original comment by lenwood...@gmail.com on 14 Feb 2013 at 9:30

GoogleCodeExporter commented 9 years ago
Lenwood, could you raise a new issue with the code for your problem? You may 
get a faster response on stackoverflow as well!

Original comment by ianbar...@google.com on 22 Mar 2013 at 4:32

GoogleCodeExporter commented 9 years ago
I have the same problem too ,but  return nothing

Original comment by aash...@gmail.com on 15 Jan 2014 at 3:34

GoogleCodeExporter commented 9 years ago
my problem is  :

runing:

 $data_array=array("reset" => true, "data" => file_get_contents("baidu_keyword.csv"), 'mimeType' => 'application/octet-stream', 'uploadType' => 'media');
        $sdfsdfs=$service->management_dailyUploads->upload("2626828", "UA-2626828-3", "XEnR38hUQ9Gd-PSpKH7M3g", "2014-01-13", 10, "cost",$data_array);

PHP Fatal error:  Uncaught exception 'Google_ServiceException' with message 
'Error calling POST 
https://www.googleapis.com/upload/analytics/v3/management/accounts/2626828/webpr
operties/UA-2626828-3/customDataSources/XEnR38hUQ9Gd-PSpKH7M3g/dailyUploads/2013
-01-13/uploads?appendNumber=10&type=cost&reset=true&uploadType=media&key=AIzaSyD
8ZgVwG36hfAZOq5L99UyDQwdd9d0xtPs: 
(403) Insufficient Permission' in 
/home/www/blog.wangyan.cc/wordpress/googleapi/src/io/Google_REST.php:66\nStack 
trace:\n#0 
/home/www/blog.wangyan.cc/wordpress/googleapi/src/io/Google_REST.php(36): 
Google_REST::decodeHttpResponse(Object(Google_HttpRequest))\n#1 
/home/www/blog.wangyan.cc/wordpress/googleapi/src/service/Google_ServiceResource
.php(186): Google_REST::execute(Object(Google_HttpRequest))\n#2 
/home/www/blog.wangyan.cc/wordpress/googleapi/src/contrib/Google_AnalyticsServic
e.php(363): Google_ServiceResource->__call('upload', Array)\n#3 
/home/www/blog.wangyan.cc/wordpress/googleapi/examples/analytics/aasheaa.php(52)
: Google_ManagementDailyUploadsServiceResource- in 
/home/www/blog.wangyan.cc/wordpress/googleapi/src/io/Google_REST.php on line 66

Original comment by aash...@gmail.com on 15 Jan 2014 at 10:37