Skip to main content

List Buckets

Retrieve all Cloud Storage buckets across all GCP projects.

Response

value
array
Array of projects with their buckets

Example Request

curl -X GET https://api.example.com/api/projects/list_buckets \
  -H "Cookie: session=your-session-token"

Example Response

{
  "value": [
    {
      "projectId": "my-project-123",
      "displayName": "My Project",
      "buckets": [
        {
          "name": "my-bucket-name",
          "location": "US",
          "storageClass": "STANDARD",
          "timeCreated": "2024-01-15T10:30:00Z"
        }
      ]
    }
  ]
}

Create Bucket

Create a new Cloud Storage bucket in a specific project.

Request Body

projectId
string
required
GCP project ID where the bucket will be created
bucketName
string
required
Globally unique name for the bucket
location
string
required
Bucket location (e.g., “US”, “EUROPE-WEST1”)
storageClass
string
default:"STANDARD"
Storage class: “STANDARD”, “NEARLINE”, “COLDLINE”, or “ARCHIVE”

Example Request

curl -X POST https://api.example.com/api/projects/create_bucket \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "bucketName": "my-unique-bucket-name",
    "location": "US",
    "storageClass": "STANDARD"
  }'

Response

message
string
Success message with bucket details
{
  "message": "Bucket 'my-unique-bucket-name' został pomyślnie utworzony w lokalizacji 'US'."
}

Configuration Details

  • Uniform bucket-level access is enabled by default
  • Bucket names must be globally unique across all GCP
  • Names must be 3-63 characters, lowercase letters, numbers, hyphens, and underscores

Delete Bucket

Delete a Cloud Storage bucket.

Request Body

projectId
string
required
GCP project ID containing the bucket
bucketName
string
required
Name of the bucket to delete
force
boolean
default:false
If true, deletes all objects in the bucket before deletion

Example Request

curl -X DELETE https://api.example.com/api/projects/delete_bucket \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "projectId": "my-project-123",
    "bucketName": "my-bucket-name",
    "force": true
  }'

Response

{
  "message": "Bucket 'my-bucket-name' został pomyślnie usunięty."
}

List Blobs in Bucket

List all objects (blobs) in a specific bucket.

Query Parameters

bucketName
string
required
Name of the bucket
projectId
string
required
GCP project ID containing the bucket

Example Request

curl -X GET "https://api.example.com/api/gcp/buckets/blobs?bucketName=my-bucket&projectId=my-project-123" \
  -H "Cookie: session=your-session-token"

Response

value
array
Array of blobs in the bucket
{
  "value": [
    {
      "name": "folder/file.txt",
      "size": 1024,
      "updated": "2024-02-20T14:30:00Z"
    }
  ]
}

Upload Blob

Upload a file to a Cloud Storage bucket.

Request Body (multipart/form-data)

file
file
required
File to upload
bucketName
string
required
Name of the destination bucket
projectId
string
required
GCP project ID containing the bucket

Example Request

curl -X POST https://api.example.com/api/gcp/buckets/blobs \
  -H "Cookie: session=your-session-token" \
  -F "file=@/path/to/local/file.txt" \
  -F "bucketName=my-bucket" \
  -F "projectId=my-project-123"

Response

{
  "message": "Plik 'file.txt' został pomyślnie wysłany."
}

Download Blob

Download a file from a Cloud Storage bucket.

Query Parameters

bucketName
string
required
Name of the bucket
projectId
string
required
GCP project ID containing the bucket
blobName
string
required
Name of the blob to download

Example Request

curl -X GET "https://api.example.com/api/gcp/buckets/blobs/download?bucketName=my-bucket&projectId=my-project-123&blobName=file.txt" \
  -H "Cookie: session=your-session-token" \
  -o downloaded-file.txt

Response

Returns the file content with appropriate Content-Type header.

Delete Blob

Delete an object from a Cloud Storage bucket.

Request Body

bucketName
string
required
Name of the bucket
projectId
string
required
GCP project ID containing the bucket
blobName
string
required
Name of the blob to delete

Example Request

curl -X DELETE https://api.example.com/api/gcp/buckets/blobs \
  -H "Content-Type: application/json" \
  -H "Cookie: session=your-session-token" \
  -d '{
    "bucketName": "my-bucket",
    "projectId": "my-project-123",
    "blobName": "file.txt"
  }'

Response

{
  "message": "Plik 'file.txt' został pomyślnie usunięty."
}

Build docs developers (and LLMs) love