Updating Assets
All Squash APIs are currently not available for accounts under the free plan. For more details please go to our plans page.
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
Please note that you need to use the separate "create folder" API first (see below) if you plan to upload files to specific folders. Squash does not create folders automatically as part of this API call.
https://api.squash.io/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.squash.io/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.squash.io/a/uploads/?repository=docker-test' & curl --request POST \ --header 'Squash-key: <key>' \ --form file=@text2.txt \ 'https://api.squash.io/a/uploads/?repository=docker-test' &
Create folder
https://api.squash.io/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.squash.io/a/uploads/create-dir/?repository=catalog_repo'
Rename file or folder
https://api.squash.io/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.squash.io/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.squash.io/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.squash.io/a/uploads/?repository=catalog_repo'