Deleting files
This guide will show you how you can delete your files.
Deleting files are permanent. Be sure that you want to delete the file since files can not be restored.
What you'll need
- API key
- Reference (UUID) of the recording or document (see annotation tool or recorder)
- Category_id (optional)
- Entity_id (optional)
- External_user_id (optional)
Deleting a single file
To delete a file you need to send a DELETE request to the Pathfindr API and reference to the file (UUID) and the API key. Replace the * API key * and UUID in the request with your API key and UUID.
curl --location --request DELETE 'https://api.pathfindr.dev/api/files/<UUID>' \
--header 'Authorization: Bearer <API key>'
If the file is succesfully deleted the response will contain a message like below:
{"uuid":"36c0175b-3e29-4d74-ba3d-3f7c9cc4fae0","message":"file attached to uuid has been deleted."}
Deleting multiple file
When you need to delete many files at the same time you can do it either by providing an array of UUID's or by sending a combination of entity_id, category_id and external_user_id.
Deleting files by UUID's
Send a POST request to the Pathfindr API with the UUIDs of the files you want to delete. Replace the * API key * and UUIDs in the request with your API key and UUIDs.
curl --location 'https://api.pathfindr.dev/api/files/bulk_delete_by_uuids' \
--header 'Authorization: Bearer API-KEY' \
--form 'file_uuids[]="881dbef6-6daf-44da-b59d-27dc390e5541"' \
--form 'file_uuids[1]="510c4dd8-0640-40da-abd9-c4f07cd71c3d"'
Deleting files by metadata (entity_id, category_id and external_user_id)
Send a POST request to the Pathfindr API with the entity_id, category_id and external_user_id of the files you want to delete. The query will return all files that match the criteria.
For example if you send a request with category_id="group1" and entity="entity_1" and no external_user_id=null the query will delete all files that have the category_id="group1" and entity="entity_1" no matter what external_user_id they have.
To delete files by metadata you need to have set the metadata when you uploaded the files. See annotation tool or recorder for more information.
Replace the * API key * in the request with your API key.
curl --location 'https://api.pathfindr.dev/api/files/bulk_delete' \
--header 'Authorization: Bearer API-KEY' \
--form 'external_user_id="1"' \
--form 'entity_id="1"' \
--form 'category_id="1"' \
--form 'file_uuids[]=""'
Delete a whole entity
To delete a whole entity you have to use a different endpoint than the one used to delete files. This has been done to prevent acidential deletion of files for a whole entity. Normally entities are used to group files for a customer, which could be business crucial for your company.
To delete a whole entity you need to send a POST request to the Pathfindr API and reference to the entity (UUID) and the API key. Replace the * API key * and UUID in the request with your API key and UUID.
curl --location 'https://api.pathfindr.dev/api/files/bulk_delete_entity' \
--header 'Authorization: Bearer API-KEY' \
--form 'entity_id="1"'