These docs are for v8.3.6. Click to read the latest docs for v8.6.3.

Handling Asset Files

Asset files may be managed via API using the following example calls. Note that you will have to replace http://your-snipe-it with your Snipe-IT url, and the xxxxxxxxxxxx with your actual bearer token.


📘

Using a self-signed certificate

If you're using a self-signed SSL certificate, you may need to pass the --insecureflag on these calls.

Upload a file

Note that in this example, test.txt is located in the directory this command is being run from

curl -request POST --url http://your-snipe-it/api/v1/hardware/1/files \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR-BEARER-TOKEN' \
--form 'file[][email protected]' \
--form 'file[][email protected]' \
--form 'file[][email protected]' \
--form 'notes=Test'

List Files

curl --request GET --url http://your-snipe-it/api/v1/hardware/1/files --header "Authorization: Bearer xxxxxxxxxx" --header 'accept: application/json' --verbose

Retrieve a File

curl --request GET --url http://your-snipe-it/api/v1/hardware/1/files/1 --header "Authorization: Bearer xxxxxxxxxx" --output downloadedfile --verbose

Delete a File

curl --request DELETE --url http://your-snipe-it/api/v1/hardware/1/files/1/delete --header "Authorization: Bearer xxxxxxxxxx" --header 'accept: application/json' --verbose