b2_update_bucketUpdate an existing bucket. Modifies the bucketType, bucket info, lifecycle rules, or CORS rules of an existing bucket. Can be used to allow everyone to download the contents of the bucket without providing any authorization, or to prevent anyone from downloading the contents of the bucket without providing a bucket auth token. RequestRequest HTTP HeadersAuthorization required
An account authorization token, obtained from
Request HTTP Message Body ParametersaccountId required The account that the bucket is in. bucketId required The unique ID of the bucket. bucketType optional
One of: "allPublic", "allPrivate". "allPublic" means that anybody can download the
files is the bucket; "allPrivate" means that you need
an authorization token to download them.
bucketInfo optional
User-defined information to be stored with the bucket: a JSON object mapping names to values.
See Buckets.
corsRules optional
The list of CORS rules for this bucket.
See CORS Rules for an overview and the rule structure.
lifecycleRules optional
The list of lifecycle rules for this bucket.
Structure defined below.
See Lifecycle Rules for an overview and the rule structure.
ifRevisionIs optional When set, the update will only happen if the revision number stored in the B2 service matches the one passed in. This can be used to avoid having simultaneous updates make conflicting changes. ResponseResponse HTTP Status 200Bucket successfully updated. The JSON response will contain: accountId The account that the bucket is in. bucketId The unique ID of the bucket. bucketName The unique name of the bucket bucketType One of: "allPublic", "allPrivate", "snapshot", or other values added in the future. "allPublic" means that anybody can download the files is the bucket; "allPrivate" means that you need an authorization token to download them; "snapshot" means that it's a private bucket containing snapshots created on the B2 web site. bucketInfo The user data stored with this bucket. corsRules The CORS rules for this bucket. See CORS Rules for an overview and the rule structure. lifecycleRules The list of lifecycle rules for this bucket. See Lifecycle Rules for an overview and the rule structure. revision
A counter that is updated every time the bucket is modified,
and can be used with the Response Errors
Bucket not updated.
If possible the server will return a JSON error structure. Errors include:
API Versionsv1: Application keys (July 26, 2018)Incompatible change: After calling b2_authorize_account with an application key that does not have the right permissions, this call will return a 401 Unauthorized. v1: Original release (September 22, 2015)Sample CodeCode
Output
Code
Output
Code
Output
Code
Output
Code
Output
Code
Output
Code
Output
|