Compressor APIStorageGoogle Cloud

Storage - Google Cloud

Integrate Google Cloud Storage with Compressor using our Secure Storage Connectors system. This approach keeps your Google Cloud credentials secure within your Compressor Account, requiring only a connector reference ID in your API calls.

Authentication

Authentication is handled exclusively through Secure Storage Connectors. Create a connector in your Compressor Account dashboard by providing your Google Cloud developer keys, then reference it using its unique identifier in your API requests.

Obtaining Google Cloud Credentials

  1. Navigate to the Cloud Storage Settings page in the Google Cloud Platform Console
  2. Select the Interoperability tab
  3. If you haven't enabled interoperability access, click "Enable interoperability access"
  4. Click "Create a new key" to generate your credentials

Save these credentials in your Compressor Account as a new Secure Storage Connector.

Authentication Configuration

{
    "store": {
        "id": "your-connector-id"
    }
}

Configuration Options

ParameterTypeRequiredDetails
bucketStringYesTarget GCS bucket name.
pathStringNoObject destination path (omit leading slash). Defaults to root.
aclStringNoObject access permissions. Default: publicRead.
metadataHashNoCustom metadata key-value pairs.
headersHashNoCustom HTTP Headers: Cache-Control, Content-Type, Content-Encoding, Content-Language, Content-Disposition.

Implementation Example

Below is a complete API request demonstrating Google Cloud Storage integration:

curl https://api.compressor.app/1.0/fetch \
  -X POST \
  -u your-api-key: \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.website.com/image.jpg",
    "image": {
      "resize": {
        "width": 640,
        "height": 480,
        "mode": "fit"
      }
    },
    "store": {
      "id": "your-connector-id",
      "bucket": "my-bucket",
      "acl": "publicRead",
      "path": "assets/image.jpg",
      "headers": {
        "Cache-Control": "max-age=2592000000"
      }
    }
  }'

API Response

Successful requests return the GCS object URL in the response.

{
  "id": "38a8bb5e-7b50-4a22-a0a6-b9602fccb225",
  "url": "https://storage.googleapis.com/images/assets/image.jpg",
  "input": {
    "name": "image.jpg",
    "type": "image",
    ...
  },
  "output": {
    "name": "image.jpg",
    "type": "image",
    ...
  }
}
On this page