Import files from cloud storage
files.import_from_cloud(FileImportFromCloudParams**kwargs) -> FileImportFromCloudResponse
POST/v5/files/cloud_imports
Register files that already exist in cloud blob storage as file records, in one batch.
Unlike upload, this transfers no bytes: each entry references an existing object by its container/bucket, filepath, filename, and MIME type, and only a metadata record pointing at that object is created. Files are imported independently and the response reports a per-file status. The response is 200 when every import succeeds and 207 when results are mixed, with each result marked SUCCESS or a failure reason (file does not exist, invalid permissions, or unknown error). Failed entries carry only the submitted filename and MIME type rather than a full file record.
Import files from cloud storage
import os
from scale_gp_beta import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
response = client.files.import_from_cloud(
files=[{
"container": "container",
"file_type": "file_type",
"filename": "filename",
"filepath": "filepath",
}],
)
print(response.results){
"results": [
{
"file": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"filename": "filename",
"md5_checksum": "md5_checksum",
"mime_type": "mime_type",
"size": 0,
"duration_seconds": 0,
"object": "file",
"tags": {
"foo": "bar"
}
},
"status": "SUCCESS"
}
]
}Returns Examples
{
"results": [
{
"file": {
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"filename": "filename",
"md5_checksum": "md5_checksum",
"mime_type": "mime_type",
"size": 0,
"duration_seconds": 0,
"object": "file",
"tags": {
"foo": "bar"
}
},
"status": "SUCCESS"
}
]
}