Re: Google Cloud Storage JSON API object insertion

182 views
Skip to first unread message

shigeta

unread,
Apr 1, 2013, 11:15:49 PM4/1/13
to google-api-...@googlegroups.com
Hi,

Sorry for my late. Your mail was moderated. And thank you for your information.
I am glad to hear you are using this module :)

I will try to use storage API and reproduce your script.
And I will let you know my result later.
Please give me a little time.

Thanks!
-- shigeta



On Friday, March 29, 2013 2:12:27 AM UTC+9, Jub wrote:
Yikes, this place is a ghost town! First of all, I just want to say that you're awesome for making this and I would love to see (and maybe help contribute to) future versions.

I'm working on something that can utilize my cloud. I can get/list objects fine, but I ran into some difficulties inserting objects. I'm not sure if I'm using your module incorrectly or if it's not supposed to be able to do this in the first place. I looked through the examples and never saw any that had to do with uploading media somewhere. You can find my script here. Right now it just runs insert_object() and exits (see line 110).
I always receive 400 Bad Request: Required at /usr/share/perl5/site_perl/Google/API/Method.pm line 93. What would be the correct way to go about this?
Not sure if it helps, but here's the output if I change insert_object() to
sub insert_object {                      
my $res = $service->objects->insert; 
print Dumper($res);                 
}                                        


$VAR1 = bless( {
                 'ua' => bless( {
                                  'max_redirect' => 7,
                                  'ssl_opts' => {
                                                  'verify_hostname' => 1
                                                },
                                  'protocols_forbidden' => undef,
                                  'show_progress' => undef,
                                  'handlers' => {
                                                  'response_header' => bless( [
                                                                                {
                                                                                  'owner' => 'LWP::UserAgent::parse_head',
                                                                                  'callback' => sub { "DUMMY" },
                                                                                  'm_media_type' => 'html',
                                                                                  'line' => '/usr/share/perl5/site_perl/LWP/UserAgent.pm:683'
                                                                                }
                                                                              ], 'HTTP::Config' )
                                                },
                                  'no_proxy' => [],
                                  'protocols_allowed' => undef,
                                  'local_address' => undef,
                                  'use_eval' => 1,
                                  'requests_redirectable' => [
                                                               'GET',
                                                               'HEAD'
                                                             ],
                                  'timeout' => 180,
                                  'def_headers' => bless( {
                                                            'user-agent' => 'libwww-perl/6.04'
                                                          }, 'HTTP::Headers' ),
                                  'proxy' => {},
                                  'max_size' => undef
                                }, 'LWP::UserAgent' ),
                 'json_parser' => bless( do{¥(my $o = '')}, 'JSON' ),
                 'base_url' => bless( do{¥(my $o = 'https://www.googleapis.com/storage/v1beta1/')}, 'URI::https' ),
                 'doc' => {
                            'request' => {
                                           '$ref' => 'Object'
                                         },
                            'supportsMediaDownload' => bless( do{¥(my $o = 1)}, 'JSON::XS::Boolean' ),
                            'httpMethod' => 'POST',
                            'response' => {
                                            '$ref' => 'Object'
                                          },
                            'path' => 'b/{bucket}/o',
                            'description' => 'Stores new data blobs and associated metadata.',
                            'scopes' => [
                                          'https://www.googleapis.com/auth/devstorage.full_control',
                                          'https://www.googleapis.com/auth/devstorage.read_write'
                                        ],
                            'parameters' => {
                                              'name' => {
                                                          'location' => 'query',
                                                          'type' => 'string',
                                                          'description' => 'Name of the object. Required when the object metadata is not otherwise provided. Overrides the object metadata¥'s name value, if any.'
                                                        },
                                              'projection' => {
                                                                'enumDescriptions' => [
                                                                                        'Include all properties.',
                                                                                        'Omit the acl property.'
                                                                                      ],
                                                                'location' => 'query',
                                                                'enum' => [
                                                                            'full',
                                                                            'no_acl'
                                                                          ],
                                                                'type' => 'string',
                                                                'description' => 'Set of properties to return. Defaults to no_acl, unless the object resource specifies the acl property, when it defaults to full.'
                                                              },
                                              'bucket' => {
                                                            'location' => 'path',
                                                            'required' => $VAR1->{'doc'}{'supportsMediaDownload'},
                                                            'type' => 'string',
                                                            'description' => 'Name of the bucket in which to store the new object. Overrides the provided object metadata¥'s bucket value, if any.'
                                                          }
                                            },
                            'mediaUpload' => {
                                               'accept' => [
                                                             '*/*'
                                                           ],
                                               'protocols' => {
                                                                'simple' => {
                                                                              'path' => '/upload/storage/v1beta1/b/{bucket}/o',
                                                                              'multipart' => $VAR1->{'doc'}{'supportsMediaDownload'}
                                                                            },
                                                                'resumable' => {
                                                                                 'path' => '/resumable/upload/storage/v1beta1/b/{bucket}/o',
                                                                                 'multipart' => $VAR1->{'doc'}{'supportsMediaDownload'}
                                                                               }
                                                              }
                                             },
                            'supportsMediaUpload' => $VAR1->{'doc'}{'supportsMediaDownload'},
                            'parameterOrder' => [
                                                  'bucket'
                                                ],
                            'id' => 'storage.objects.insert'
                          },
                 'opt' => {}
               }, 'Google::API::Method' );

Jub

unread,
Apr 4, 2013, 11:52:23 AM4/4/13
to google-api-...@googlegroups.com
しげたおりがと!
がんばてね!!!

Takatsugu Shigeta

unread,
Apr 4, 2013, 12:04:57 PM4/4/13
to google-api-...@googlegroups.com
ありがとう!
がんばります :D



--
You received this message because you are subscribed to the Google Groups "google-api-perl-client" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-api-perl-c...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Takatsugu Shigeta

Takatsugu Shigeta

unread,
Apr 6, 2013, 5:33:41 AM4/6/13
to google-api-...@googlegroups.com
I'm still waiting for availability permits for Google Could Storage JSON API :(
I requested the permits to Google via the request form. But I don't get the permits yet.
Please wait for a while until I get the permits.
Thanks in advance!
--
Takatsugu Shigeta

Takatsugu Shigeta

unread,
Apr 16, 2013, 2:25:30 PM4/16/13
to google-api-...@googlegroups.com
Hi,

I got the permits. Then I tried to create a sample for uploading a
file. Please see following file.

https://github.com/comewalk/google-api-perl-client/blob/feature-file-upload/eg/storage/v1beta1/objects.pl

So far, you can upload a file like above sample.

Above branch is a feature branch. I may change core codes more later.
Because I need more implements to support following features.
* uploading and downloading files with metadata as multipart
* resumable uploading and downloading
* more samples for BucketAccessControls, Buckets, ObjectAccessControls. Objects

Stay tuned!

Thanks,
-- shigeta
--
Takatsugu Shigeta

Jub

unread,
Apr 22, 2013, 10:45:48 AM4/22/13
to google-api-...@googlegroups.com
ありがとうございます!だいすき<3
>>> email to google-api-perl-client+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages