Updating Assets

After submitting API calls it may take from 1 to 3 minutes for the changes to be fully propagated. This depends on the number and size of the files updated within the assets folder.

Upload file

https://api.squashlabs.wpengine.com/a/uploads/?repository=<repository_name>

HTTP Method: POST
Success Response Code: 200
Success Response Body: JSON data

Sample Request

curl --request POST \
--header 'Squash-key: <key>' \
--form file=@catalog.txt \
https://api.squashlabs.wpengine.com/a/uploads/?repository=catalog_repo

Sample Request – custom folder

Squash will automatically create the folder if it doesn’t exist.

curl --request POST \
--header 'Squash-key: <key>' \
--form file=@catalog.txt \
--form name=products/catalog.txt \
https://api.squashlabs.wpengine.com/a/uploads/?repository=catalog_repo

 

Upload multiple files

Squash requires one API call per file.

Sample Request

In the example below we are uploading two files keeping the process in the background to speed things up.

curl --request POST \
--header 'Squash-key: <key>' \
--form file=@text.txt \
https://api.squashlabs.wpengine.com/a/uploads/?repository=docker-test &

curl --request POST \
--header 'Squash-key: <key>' \
--form file=@text2.txt \
https://api.squashlabs.wpengine.com/a/uploads/?repository=docker-test &

Create folder

https://api.squashlabs.wpengine.com/a/uploads/create-dir/?repository=<repository_name>

HTTP Method: POST
Success Response Code: 200
Success Response Body: JSON data

Sample Request

curl --request POST \
--header "Content-Type: application/json"  \
--header 'Squash-key: <key>' \
--data '{"directory": "products"}' \
https://api.squashlabs.wpengine.com/a/uploads/create-dir/?repository=catalog_repo

 

Rename file or folder

https://api.squashlabs.wpengine.com/a/uploads/rename/?repository=<repository_name>

HTTP Method: POST
Success Response Code: 200
Success Response Body: JSON data

Sample Request

curl --request POST \
--header "Content-Type: application/json"  \
--header 'Squash-key: <key>' \
--data '{"old_name": "catalog", "new_name": "catalog-renamed"}' \
https://api.squashlabs.wpengine.com/a/uploads/rename/?repository=catalog_repo

Delete file or folder

This is the same API call as Upload File with the addition of a to_delete=True form field.

Sample Request

curl --request POST \
--header 'Squash-key: <key>' \
--form to_delete=True \
--form name=products/catalog.txt \
https://api.squashlabs.wpengine.com/a/uploads/?repository=catalog_repo

You may also delete a folder as follows:

curl --request POST \
--header 'Squash-key: <key>' \
--form to_delete=True \
--form name=products/ \
https://api.squashlabs.wpengine.com/a/uploads/?repository=catalog_repo