MSDN Documentation

Storage API

The Storage API provides functionalities to manage and interact with data storage services. This includes operations for uploading, downloading, deleting, and listing files and data.

Core Concepts

Understanding these concepts is crucial for effective use of the Storage API:

  • Buckets: Logical containers for storing objects.
  • Objects: The actual data files or pieces of information stored within a bucket.
  • Access Control: Mechanisms to define permissions for accessing buckets and objects.

Available Methods

POST /storage/buckets

+

Create a New Bucket

Creates a new bucket to store your data.

Request Body
{
  "bucketName": "my-unique-bucket-name",
  "region": "us-east-1",
  "acl": "private"
}
Parameters
Name Type Required Description
bucketName String Yes A unique name for the bucket. Must be globally unique.
region String No The geographical region where the bucket will be created (e.g., "us-west-2", "eu-central-1"). Defaults to the account's default region.
acl String No Access control list for the bucket. Options: public-read, private. Defaults to private.
Response
Status: 201 Created
Body:
{
  "bucketId": "bucket-uuid-12345",
  "bucketName": "my-unique-bucket-name",
  "creationDate": "2023-10-27T10:00:00Z"
}

GET /storage/buckets/{bucketId}

+

Get Bucket Details

Retrieves detailed information about a specific bucket.

Parameters
Name Type Required Description
bucketId String Yes The unique identifier of the bucket.
Response
Status: 200 OK
Body:
{
  "bucketId": "bucket-uuid-12345",
  "bucketName": "my-unique-bucket-name",
  "region": "us-east-1",
  "acl": "private",
  "creationDate": "2023-10-27T10:00:00Z",
  "objectCount": 150,
  "totalSize": 52428800
}

DELETE /storage/buckets/{bucketId}

+

Delete a Bucket

Deletes a specific bucket and all its contents. This action is irreversible.

Parameters
Name Type Required Description
bucketId String Yes The unique identifier of the bucket to delete.
Response
Status: 204 No Content

POST /storage/buckets/{bucketId}/objects

+

Upload an Object

Uploads a new object (file) to the specified bucket.

Request Body

multipart/form-data

Parameters
Name Type Required Description
bucketId String Yes The identifier of the bucket to upload to.
file File Yes The file to upload.
objectName String No A name for the object. If not provided, a name will be generated.
acl String No Access control list for the object. Options: public-read, private. Defaults to bucket's ACL.
Response
Status: 201 Created
Body:
{
  "objectId": "object-uuid-abcdef12345",
  "bucketId": "bucket-uuid-12345",
  "objectName": "my-uploaded-file.txt",
  "url": "https://storage.msdn.example.com/buckets/bucket-uuid-12345/objects/object-uuid-abcdef12345",
  "uploadDate": "2023-10-27T11:30:00Z"
}

GET /storage/buckets/{bucketId}/objects/{objectId}

+

Download an Object

Retrieves an object from the specified bucket.

Parameters
Name Type Required Description
bucketId String Yes The identifier of the bucket containing the object.
objectId String Yes The unique identifier of the object to download.
Response
Status: 200 OK
Headers: Content-Type: application/octet-stream
Content-Disposition: attachment; filename="my-downloaded-file.txt" Body: The raw content of the object.

DELETE /storage/buckets/{bucketId}/objects/{objectId}

+

Delete an Object

Deletes a specific object from the specified bucket.

Parameters
Name Type Required Description
bucketId String Yes The identifier of the bucket containing the object.
objectId String Yes The unique identifier of the object to delete.
Response
Status: 204 No Content