以下のパスから、Cloud Storage Module を使用するための Objective C 用の Google API を取得しました。
残念ながら、API には Cloud Storage のサンプル コードが含まれていなかったため、自分で実行しようとしましたが、うまくいきませんでした。以下は私がやっていることです
- Google API コンソールから Cloud Storage の課金を有効にしました
- 「ahs_test」という名前のバケットを作成しました
- インストール済みアプリのクライアントIDを作ってみた
- Outh2.0 では上位の SVN Path で利用可能なライブラリを使用して成功しました。これを行った後、私は以下のコードを書き、以下のエラーメッセージを取得しました
- Google Cloud Storage を読んだ後、リクエスト ヘッダーで「x-goog-project-id」を送信する必要があることは確かですが、この API のコードはそのようなことをしないのではないかと思っています。(私は何らかの間違いをしているかもしれないので、何らかの助けを得るためにこれを残してください..事前に感謝します...)
// Code....
GTLServiceStorage *service = self.storageService
GTLQueryStorage *query = [GTLQueryStorage queryForBucketsGetWithBucket:@"ahs_test"];
_fileListTicket = [service executeQuery:query
completionHandler:^(GTLServiceTicket *ticket,
GTLStorageBuckets *bucketList,
NSError *error) {
}];
// Error Message I get (Detailed from loger)
storage.buckets.get
2012-12-30 07:11:30 +0000
Request: POST https://www.googleapis.com/rpc?prettyPrint=false
Request headers:
Accept: application/json-rpc
Authorization: Bearer _snip_
Cache-Control: no-cache
Content-Type: application/json-rpc; charset=utf-8
User-Agent: com.example.DriveSample/1.0 google-api-objc-client/2.0 MacOSX/10.8 (gzip)
Request body: (128 bytes)
{
"jsonrpc" : "2.0",
"method" : "storage.buckets.get",
"id" : "gtl_3",
"params" : {
"bucket" : "ahs_test",
"max-results" : 150
},
"apiVersion" : "v1beta1"
}
Response: status 200
Response headers:
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Encoding: gzip
Content-Length: 132
Content-Type: application/json; charset=UTF-8
Date: Sun, 30 Dec 2012 07:10:44 GMT
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Pragma: no-cache
Server: GSE
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Response body: (168 bytes)
{
"error" : {
"message" : "Access Not Configured",
"data" : [
{
"reason" : "accessNotConfigured",
"message" : "Access Not Configured",
"domain" : "usageLimits"
}
],
"code" : 403
},
"id" : "gtl_3"
}