Media Management
This endpoint group provides functionality for managing media files and folders, including listing, creating, renaming, deleting, importing, and handling file uploads.
Endpoints
POST /api/rpc (Method: MediaManagerRpc.listFiles)
Description: Lists files and folders in a given path and scope.
Request Body:
{ "method": "MediaManagerRpc.listFiles", "params": { "scope": "subscription", "path": "" } }Parameters:
Name Type Required Description scopeStringYes The scope of the media files. Must be 'subscription' or 'global'. pathStringNo The path within the given scope to list. Defaults to the root of the scope. Response:
{ "success": true, "data": [ { "name": "my-folder", "type": "directory", "relativePath": "my-folder" }, { "name": "image.png", "type": "file", "relativePath": "image.png" } ] }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.listFiles", "params": { "scope": "subscription", "path": "my-project-media" } }'
POST /api/rpc (Method: MediaManagerRpc.createFolder)
Description: Creates a new folder.
Request Body:
{ "method": "MediaManagerRpc.createFolder", "params": { "scope": "subscription", "currentPath": "my-project-media", "folderName": "new-assets" } }Parameters:
Name Type Required Description scopeStringYes The scope where the folder will be created. Must be 'subscription'. currentPathStringYes The path where the new folder will be created. folderNameStringYes The name of the new folder. Must not be empty. Response:
{ "success": true, "data": { "success": true, "path": "/path/to/new-folder" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.createFolder", "params": { "scope": "subscription", "currentPath": "my-project-media", "folderName": "new-assets" } }'
POST /api/rpc (Method: MediaManagerRpc.renameItem)
Description: Renames a file or folder.
Request Body:
{ "method": "MediaManagerRpc.renameItem", "params": { "scope": "subscription", "oldPath": "my-project-media/old-name.txt", "newName": "new-name.txt" } }Parameters:
Name Type Required Description scopeStringYes The scope where the item exists. Must be 'subscription'. oldPathStringYes The current path of the file or folder to rename. newNameStringYes The new name for the file or folder. Must not be empty. Response:
{ "success": true, "data": { "success": true } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.renameItem", "params": { "scope": "subscription", "oldPath": "my-project-media/old-name.txt", "newName": "new-name.txt" } }'
POST /api/rpc (Method: MediaManagerRpc.deleteItem)
Description: Deletes a file or folder.
Request Body:
{ "method": "MediaManagerRpc.deleteItem", "params": { "scope": "subscription", "itemPath": "my-project-media/to-delete.png" } }Parameters:
Name Type Required Description scopeStringYes The scope where the item exists. Must be 'subscription'. itemPathStringYes The path of the file or folder to delete. Response:
{ "success": true, "data": { "success": true } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.deleteItem", "params": { "scope": "subscription", "itemPath": "my-project-media/to-delete.png" } }'
POST /api/rpc (Method: MediaManagerRpc.importFromUrl)
Description: Imports a file from a public URL.
Request Body:
{ "method": "MediaManagerRpc.importFromUrl", "params": { "scope": "subscription", "currentPath": "my-project-media/imports", "url": "https://example.com/image.jpg" } }Parameters:
Name Type Required Description scopeStringYes The scope where the file will be imported. Must be 'subscription'. currentPathStringYes The path within the given scope to save the imported file. urlStringYes The public URL of the file to import. Response:
{ "success": true, "data": { "success": true, "fileName": "image.jpg" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.importFromUrl", "params": { "scope": "subscription", "currentPath": "my-project-media/imports", "url": "https://example.com/image.jpg" } }'
POST /api/rpc (Method: MediaManagerRpc.getUploadKey)
Description: Gets an upload key for uploading files. This key is used to initiate a file upload to the
/api/upload/:keyendpoint.Request Body:
{ "method": "MediaManagerRpc.getUploadKey", "params": { "scope": "subscription", "currentPath": "my-project-media/uploads", "fileConfig": { "fileTypes": ["image/*"], "maxFiles": 5, "maxFileSize": 10485760 } } }Parameters:
Name Type Required Description scopeStringYes The scope where the file will be uploaded. Must be 'subscription'. currentPathStringYes The path within the given scope where the uploaded file will be stored. fileConfigObjectYes Configuration for the upload, including allowed file types (e.g., ["image/*", "application/pdf"]), maximum number of files, and maximum file size in bytes.Response:
{ "success": true, "data": { "key": "a-unique-upload-key", "server": "https://api.example.com", "url": "/upload/a-unique-upload-key" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.getUploadKey", "params": { "scope": "subscription", "currentPath": "my-project-media/uploads", "fileConfig": { "fileTypes": ["image/*"], "maxFiles": 1, "maxFileSize": 5242880 } } }'
POST /api/rpc (Method: MediaManagerRpc.finalizeUpload)
Description: Finalizes a file upload, moving it from temporary storage to permanent storage. Delegates to UploadDownloadService.
Request Body:
{ "method": "MediaManagerRpc.finalizeUpload", "params": { "uploadKey": "a-unique-upload-key" } }Parameters:
Name Type Required Description uploadKeyStringYes The unique key obtained from getUploadKeyto finalize the upload.Response:
{ "success": true, "data": { "success": true, "files": [ { "filePath": "media/subscriptionId/my-project-media/uploads/uploaded-image.png", "fileId": "file-uuid", "fileName": "uploaded-image.png", "fileType": "image/png", "size": 123456 } ] } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "MediaManagerRpc.finalizeUpload", "params": { "uploadKey": "a-unique-upload-key" } }'