Skip to content

Commit 6ce57f1

Browse files
committed
Document file and folder deletion endpoints
1 parent 9eba099 commit 6ce57f1

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

source/includes/_files.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,142 @@ Also, folders cannot be moved into themselves.
336336
|-----------|---------|--------------------------------------------------------|
337337
| `status` | boolean | True if the request was successful. |
338338
| `message` | string | Success message or error message if `status` is false. |
339+
340+
## Delete File(s)
341+
342+
```shell
343+
curl https://api.simplyprint.io/{id}/files/DeleteFile?file=abc123,def456 \
344+
-H 'accept: application/json' \
345+
-H 'X-API-KEY: {API_KEY}'
346+
```
347+
348+
> Success response
349+
350+
```json
351+
{
352+
"status": true,
353+
"message": null,
354+
"deleted": 2
355+
}
356+
```
357+
358+
> Partial failure response (some files deleted, some failed)
359+
360+
```json
361+
{
362+
"status": false,
363+
"message": "One or more files failed to be deleted",
364+
"errors": [
365+
"File abc123 doesn't exist or doesn't belong to you"
366+
],
367+
"deleted": 1
368+
}
369+
```
370+
371+
> Failure response: no file IDs specified
372+
373+
```json
374+
{
375+
"status": false,
376+
"message": "No file ID(s) specified"
377+
}
378+
```
379+
380+
> Failure response: no matching files found
381+
382+
```json
383+
{
384+
"status": false,
385+
"message": "No file(s) with ID(s) exist"
386+
}
387+
```
388+
389+
This endpoint deletes one or more files. Each file ID must belong to the requesting user and be modifiable; if any file
390+
cannot be deleted (e.g., due to missing permission or nonexistence), the call fails with error details.
391+
392+
### Request
393+
394+
`GET /{id}/files/DeleteFile`
395+
396+
| Parameter | Type | Required | Description |
397+
|-----------|--------|----------|---------------------------------------------|
398+
| `file` | string | yes | Comma-separated list of file IDs to delete. |
399+
400+
### Response
401+
402+
| Parameter | Type | Description |
403+
|-----------|-------------|----------------------------------------------------------------------------------|
404+
| `status` | boolean | True if the request succeeded (all specified deletions succeeded). |
405+
| `message` | string/null | Error message if something went wrong. |
406+
| `deleted` | integer | Number of files actually deleted. |
407+
| `errors` | string[] | (Optional) Array of error strings explaining why specific file deletions failed. |
408+
409+
## Delete Folder(s)
410+
411+
```shell
412+
curl https://api.simplyprint.io/{id}/files/DeleteFolder?folder=123,456 \
413+
-H 'accept: application/json' \
414+
-H 'X-API-KEY: {API_KEY}'
415+
````
416+
417+
> Success response
418+
419+
```json
420+
{
421+
"status": true,
422+
"message": null,
423+
"deleted": 2
424+
}
425+
```
426+
427+
> Partial failure response (some folders deleted, some failed during removal)
428+
429+
```json
430+
{
431+
"status": false,
432+
"message": "One or more folders failed to be deleted",
433+
"deleted": 1,
434+
"errors": [
435+
"Failed to remove folder with ID 456: underlying exception message"
436+
]
437+
}
438+
```
439+
440+
> Failure response: no folder IDs specified
441+
442+
```json
443+
{
444+
"status": false,
445+
"message": "No file ID(s) specified"
446+
}
447+
```
448+
449+
> Failure response: folder does not exist or not modifiable (either because it’s missing or the user lacks permission)
450+
451+
```json
452+
{
453+
"status": false,
454+
"message": "One or more folders do not exist"
455+
}
456+
```
457+
458+
This endpoint deletes one or more folders. All specified folder IDs must exist and be modifiable by the requesting user;
459+
if existence or permission validation fails up front, the request fails immediately. If some deletions fail during
460+
removal, those errors are returned while successful deletions are counted.
461+
462+
### Request
463+
464+
`GET /{id}/files/DeleteFolder`
465+
466+
| Parameter | Type | Required | Description |
467+
|-----------|--------|----------|-----------------------------------------------|
468+
| `folder` | string | yes | Comma-separated list of folder IDs to delete. |
469+
470+
### Response
471+
472+
| Parameter | Type | Description |
473+
|-----------|-------------|------------------------------------------------------------------------------------------|
474+
| `status` | boolean | True if the request succeeded (all specified deletions succeeded). |
475+
| `message` | string/null | `null` on full success; error message if something went wrong. |
476+
| `deleted` | integer | Number of folders actually deleted. |
477+
| `errors` | string\[] | (Optional) Array of error strings explaining failures during deletion (partial failure). |

0 commit comments

Comments
 (0)