Bucket insert fails with error code 400

google-cloud-storage

Solution

bucket names must be lowercase. There are a number of other restrictions as well - please see https://developers.google.com/storage/docs/bucketnaming#requirements

Problem

Here is the code segment: ``` Bucket newBucket = storage.buckets().insert("MyProject", new Bucket().setName("MyBucket").setLocation("US").setStorageClass("DURABLE_REDUCED_AVAILABILITY")).execute(); } catch (GoogleJsonResponseException e) { System.out.println("Exception in tryCreateBucket: "+e); throw e; } ``` It throws: Exception in tryCreateBucket: ``` com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid Value", "reason" : "invalid" } ], "message" : "Invalid Value" } ``` Any thoughts on how to fix this problem? Thanks /VK

Original source