Voog.com

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

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 the confirm 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 the confirm 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

Example
Copy
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

Example
Copy
POST https://helloworld.voog.com/admin/api/import_files
Example
Copy
{
"filename": "product-import.xls",
"size": 1111,
"content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}

Example response

Example
Copy
{
"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

Example
Copy
PUT /admin/api/import_files/:id/confirm

Example request

Example
Copy
PUT https://helloworld.voog.com/admin/api/import_files/1/confirm

Example response

Example
Copy
{
"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

Example
Copy
GET /admin/api/import_files/:id

Example request

Example
Copy
GET https://helloworld.voog.com/admin/api/import_files/1

Example response

Example
Copy
{
"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

Example
Copy
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

Example
Copy
GET https://helloworld.voog.com/admin/api/import_files
Example
Copy
[
{
"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

Example
Copy
DELETE /admin/api/import_files/:id

Example request

Example
Copy
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:

Example
Copy
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:

Example
Copy
x-amz-acl: public-read
content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
content-length: 1111

Curl example:

Example
Copy
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.

Code example in Ruby.

Code example in Node.