Skip to content

Latest commit

 

History

History
182 lines (127 loc) · 4.57 KB

salad-simple-storage-service.mdx

File metadata and controls

182 lines (127 loc) · 4.57 KB
title description
Salad Simple Storage
This is a simple HTTP service to allow SaladCloud customers to temporarily upload assets for use in other SaladCloud services. Examples include uploading images for stable diffusion training or inference, audio clips for transcription, etc.

Limitations

  • Maximum file size is 100MB
  • Files will be automatically deleted after 30 days

Endpoints

Authorization

Requests to the S4 service must include either:

  • A Salad-Api-Key header with a valid SaladCloud API key.
  • An Authorization header with a valid SaladCloud JWT (issued by the Instance Metadata Service) as a bearer token.

Upload a File

PUT /organizations/:organization_name/files/:filename+

Uploads a file to the specified organization.

Request Parameters:

  • organization_name (string): The name of the organization.
  • filename (string): The name of the file to upload. This can be a path, and the file will be stored in a directory structure based on the path. e.g. path/to/my/file.tar.gz will be stored as path/to/my/file.tar.gz.

Example Request:

curl  -X PUT \
  'https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz' \
  --header 'Salad-Api-Key: YOURAPIKEY' \
  --form 'mimeType="application/tar+gzip"' \
  --form 'file=@/path/to/my/file.tar.gz'

Example Response:

{
  "url": "https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz"
}

Example Request, Creating Signed URL

When uploading a file, you can optionally request to sign the url, which will allow you to use the returned url to fetch the file without needing to include the Salad-Api-Key header.

curl  -X PUT \
  'https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz' \
  --header 'Salad-Api-Key: YOURAPIKEY' \
  --form 'mimeType="application/tar+gzip"' \
  --form 'file=@/path/to/my/file.tar.gz' \
  --form 'sign=true' \
  --signatureExp '86400'

Example Response, Signed URL

{
  "url": "https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz?token=8eb6de1b-b313-4169-8411-39860ebc73ab"
}

Download a File

GET /organizations/:organization_name/files/:filename+

Downloads a file from the specified organization.

Request Parameters:

  • organization_name (string): The name of the organization.
  • filename (string): The name of the file to download.

Example Request:

curl -X GET \
  'https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz' \
  --header 'Salad-Api-Key: YOURAPIKEY' \
  --output file.tar.gz

Delete a File

DELETE /organizations/:organization_name/files/:filename+

Deletes a file from the specified organization.

Request Parameters:

  • organization_name (string): The name of the organization.
  • filename (string): The name of the file to delete.

Example Request:

curl -X DELETE \
  'https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz' \
  --header 'Salad-Api-Key: YOURAPIKEY'

List Files

GET /organizations/:organization_name/files

Lists all files within the specified organization.

Request Parameters:

  • organization_name (string): The name of the organization.

Example Request:

curl -X GET \
  'https://storage-api.salad.com/organizations/salad-benchmarking/files' \
  --header 'Salad-Api-Key: YOURAPIKEY'

Example Response:

{
  "files": [
    {
      "url": "https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz",
      "size": 1024,
      "mimeType": "application/tar+gzip",
      "uploaded": "2021-09-01T12:00:00Z",
      "etag": "1234567890"
    }
  ]
}

Get A Signed Url for a File

POST /organizations/:organization_name/file_tokens/:filename+

Creates a signed URL for a file in the specified organization.

Request Parameters:

  • organization_name (string): The name of the organization.
  • filename (string): The name of the file to create a signed URL for.

Example Request:

curl -X POST \
  'https://storage-api.salad.com/organizations/salad-benchmarking/file_tokens/path/to/my/file.tar.gz' \
  --header 'Salad-Api-Key: YOURAPIKEY' \
  --data '{"method": "GET", "expires": 86400}'

Example Response:

{
  "url": "https://storage-api.salad.com/organizations/salad-benchmarking/files/path/to/my/file.tar.gz?token=974360ea-63f7-4db3-9692-72ca5dbae615"
}