Zum Inhalt springen

API Endpoint

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

The Storage API exposes endpoints that can be accessed via HTTP requests. The following sections describe the available endpoints and their usage.

To upload or update a file in the storage system, you can use the PUT method on the /studiocms_api/storage/manager endpoint.

Storage API - PUT /studiocms_api/storage/manager
PUT /studiocms_api/storage/manager HTTP/1.1
Host: example.com
Content-Type: application/octet-stream
Accept: application/json
Headers:
x-storage-key: my-file.txt
<file-content>
Storage API - PUT Success Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"message": "string",
"key": "string"
}
Storage API - PUT Error Response
HTTP/1.1 4XX/5XX Error
Content-Type: application/json
{
"error": "string"
}
Storage API - POST /studiocms_api/storage/manager
POST /studiocms_api/storage/manager HTTP/1.1
Host: example.com
Content-Type: application/json
Accept: application/json
{
"action": "resolveUrl | publicUrl | upload | list | delete | rename | download | cleanup | mappings | test",
...additional parameters based on action...
}
  • resolveUrl
  • publicUrl
    • Params: { key: string }
    • Response: UrlMetadata & { identifier: string }
  • upload
    • Params: { key: string, contentType: string }
    • Response: { url: string, key: string }
  • list
    • Params: { prefix?: string, key?: string }
    • Response: { files: File[] }
  • delete
    • Params: { key: string }
    • Response: { success: boolean }
  • rename
    • Params: { key: string, newKey: string }
    • Response: { success: boolean, newKey: string }
  • download
    • Params: { key: string }
    • Response: { url: string }
  • cleanup
    • Params: N/A
    • Response: { deletedCount: number }
  • mappings
  • test
    • Params: N/A
    • Response: { success: boolean, message: string, provider: string }
Storage API - POST Error Response
HTTP/1.1 4XX/5XX Error
Content-Type: application/json
{
"error": "string"
}
export interface UrlMetadata {
url: string;
isPermanent: boolean;
expiresAt?: number; // Unix timestamp in ms
}
export interface File {
key: string | undefined;
size: number | undefined;
lastModified: Date | undefined;
}