Import files
This API allows you to store temporary files for import purposes (see products import for example).
Files are stored for 24 hours and then automatically deleted.
Maximum file size is 10MB.
Summary of import files endpoints
- POST /admin/api/import_files — create an import file object to the server.
- PUT /admin/api/import_files/:id/confirm — confirm that the file is uploaded to destination.
- GET /admin/api/import_files/:id — get an import file object.
- GET /admin/api/import_files — get a list of import files.
- DELETE /admin/api/import_files/:id — delete an import file.
The import file object
Attributes
filename
— the name of the file.size
— the size of the file in bytes.content_type
— the MIME type of the file.
Read only attributes
confirm_url
— the URL where theconfirm
request should be sent to.created_at
— timestamp when the import file object was created.expires_at
— timestamp when the import file will be deleted.id
— the ID of the import file.public_url
— the URL where the file can be downloaded from.status
— the status of the import file. Possible values are:pending
— the file object has been created but the file has not been uploaded yet.success
— the file has been successfully uploaded to the destination and theconfirm
request sent.
updated_at
— timestamp when the import file object was last updated.upload_url
— the URL where the file should be uploaded to (see upload example).url
— the API URL of the import file object.
Create an import file object
POST /admin/api/import_files
Attributes
See above for a detailed description of the request payload.
After successful creation, the file should be uploaded to the upload_url
returned by the API.
Read more about uploading assets.
Example request
POST https://helloworld.voog.com/admin/api/import_files
{
"filename": "product-import.xls",
"size": 1111,
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
Example response
{
"id": 1,
"filename": "product-import.xls",
"status": "pending",
"size": 1111,
"expires_at": "2024-01-08T17:51:30.165Z",
"created_at": "2024-01-07T17:51:30.174Z",
"updated_at": "2024-01-07T17:51:30.174Z",
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"url": "https://helloworld.voog.com/admin/api/import_files/1",
"public_url": "http://media.voog.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls",
"upload_url": "http://media.voog.com.s3-eu-west-1.amazonaws.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls?AWSAccessKeyId=XXXXXXXXXX\u0026Expires=1704653490\u0026Signature=AxavFAQTlNyR8qTe8xa0IBtQPAw%3D",
"confirm_url": "https://helloworld.voog.com/admin/api/import_files/1/confirm"
}
Confirm an import file object
PUT /admin/api/import_files/:id/confirm
Example request
PUT https://helloworld.voog.com/admin/api/import_files/1/confirm
Example response
{
"id": 1,
"filename": "product-import.xls",
"status": "success",
"size": 1111,
"expires_at": "2024-01-08T17:51:30.165Z",
"created_at": "2024-01-07T17:51:30.174Z",
"updated_at": "2024-01-07T17:51:40.174Z",
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"url": "https://helloworld.voog.com/admin/api/import_files/1",
"public_url": "http://media.voog.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls"
}
Get an import file object
GET /admin/api/import_files/:id
Example request
GET https://helloworld.voog.com/admin/api/import_files/1
Example response
{
"id": 1,
"filename": "product-import.xls",
"status": "success",
"size": 1111,
"expires_at": "2024-01-08T17:51:30.165Z",
"created_at": "2024-01-07T17:51:30.174Z",
"updated_at": "2024-01-07T17:51:40.174Z",
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"url": "https://helloworld.voog.com/admin/api/import_files/1",
"public_url": "http://media.voog.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls"
}
Get a list of import files
GET /admin/api/import_files
Query string parameters
per_page
— orders per response (default:50
; maximum:250
).page
— requested page (default:1
).
Filter attributes
Read more about filters.
- Object
import_file
attributes:id
,filename
,status
,size
,expires_at
,created_at
,updated_at
.
Example request
GET https://helloworld.voog.com/admin/api/import_files
[
{
"id": 1,
"filename": "product-import.xls",
"status": "success",
"size": 1111,
"expires_at": "2024-01-08T17:51:30.165Z",
"created_at": "2024-01-07T17:51:30.174Z",
"updated_at": "2024-01-07T17:51:40.174Z",
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"url": "https://helloworld.voog.com/admin/api/import_files/1",
"public_url": "http://media.voog.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls"
}
]
Delete an import file
DELETE /admin/api/import_files/:id
Example request
Status: 204 No Content
Uploading assets to destination
Here's a basic example of uploading an file to the upload_url
returned by the API:
PUT http://media.voog.com.s3-eu-west-1.amazonaws.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls?AWSAccessKeyId=XXXXXXXXXX\u0026Expires=1704653490\u0026Signature=AxavFAQTlNyR8qTe8xa0IBtQPAw%3D
Required headers:
x-amz-acl: public-read
content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
content-length: 1111
Curl example:
curl -X PUT \
-H "x-amz-acl: public-read" \
-H "content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" \
-H "content-length: 1111" \
--data-binary @product-import.xls \
"http://media.voog.com.s3-eu-west-1.amazonaws.com/0000/0000/0001/import_files/cbd273be-aa7f-4c95-b0bb-d356ded11738/product-import.xls?AWSAccessKeyId=XXXXXXXXXX\u0026Expires=1704653490\u0026Signature=AxavFAQTlNyR8qTe8xa0IBtQPAw%3D"
The request body has to be the raw file data as a byte array (Buffer in NodeJS, Blob in Javascript etc.).
For more details, refer to the official Amazon AWS documentation.