I can create Bucket in my cloub but I can not find how to retrieve the url to send files in this bucket.
I can find my bucket with its name :
try {
getBucket = storage.buckets().get("bucketName");
Bucket bucket = getBucket.execute();
System.out.println(bucket.getDefaultObjectAcl());
} catch (IOException e) {
e.printStackTrace();
}
But getDefaultObjectAcl and getAcl send me null.
How to retrieve this url? Thx.
I found how to upload a file without Token.
https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
First you must use Token and file's info you want to upload to create the resumable upload link.
Send this to google.
POST /upload/storage/v1/b/myBucket/o?uploadType=resumable HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer your_auth_token
Content-Length: 38
Content-Type: application/json; charset=UTF-8
X-Upload-Content-Type: image/jpeg
X-Upload-Content-Length: 2000000
{
"name": "myObject"
}
In the response header there is a link to use to upload a file to Google Cloud storage.
Location: https://example.storage.googleapis.com/music.mp3?upload_id=tvA0ExBntDa...gAAEnB2Uowrot