Imports a file to the Media Manager using an external url.
Returns information about the imported file.
Specify the parentFolderId
and filePath
parameters to specify which folder you want the file to be imported to.
If no folder is specified, the file is imported to the media-root
folder.
Notes:
To import a file, you need to do one of the following:
mimeType
field of the request. For example, mimeType: 'image/jpeg'
.displayName
or url
field of the request. For example, displayName: 'Example Image.jpeg
or url: https://www.example.com/image.jpeg
.Note: If you want to validate the media type, specify the file's expected media type in the optional mediaType
field of the request. For example, mediaType: 'IMAGE'
.
You can only call this method when authenticated as a Wix app or Wix user identity.
Publicly accessible external file URL.
Media type of the file to import. excluding: OTHER media type
File name that appears in the Media Manager.
ID of the file's parent folder.
This folder is the path root for the filePath
.
Default: media-root
.
Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by Google Vision API for images.
File mime type.
Optional parameters that should be sent with the external URL.
Optional headers that should be sent with the external URL.
Path to the folder where the file will be stored.
For example, /videos/2024/december
.
If parentFolderId
is defined, the parent folder is used as the path root. Otherwise, the root is media-root
.
The folders in the path will be created if they don't already exist.
Information about the imported file.
curl -X POST \
'https://www.wixapis.com/site-media/v1/files/import' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
--data-binary '{
"mimeType": "image/jpeg",
"displayName": "T-shirt",
"parentFolderId":"25284aa06584441ea94338fdcfbaba12",
"private": false,
"url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png"
}'
{
"file": {
"id": "4acbb8_f968336b3fea4cbebc056d5c41f9944d~mv2.png",
"displayName": "T-shirt.png",
"url": "https://static.wixstatic.com/media/4acbb8_f968336b3fea3cbebc056d5c41f9944d~mv2.png",
"parentFolderId": "25284aa06584441ea94338fdcfbaba12",
"hash": "",
"sizeInBytes": "7108",
"private": false,
"mediaType": "IMAGE",
"media": null,
"operationStatus": "PENDING",
"sourceUrl": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png",
"thumbnailUrl": "https://static.wixstatic.com/media/4acbb8_f968336b3f4a4cbebc056d5c41f9944d~mv2.png",
"labels": [],
"createdDate": "2022-08-31T18:20:37Z",
"updatedDate": "2022-08-31T18:20:37Z",
"state": "OK"
}
}
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.