From f3b4fab2e9c7d5653502f593ca44ab666bcc3edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karlo=20=C5=A0imunovi=C4=87?= Date: Thu, 4 Sep 2025 11:10:00 +0200 Subject: [PATCH 1/2] Add API endpoint for deleting a collection Document the new DELETE request for removing a collection from the API. This addition enables users to manage collections more effectively by allowing deletion when collections are no longer needed. - Includes HTTP request format and URL parameters - Lists possible response codes and error messages - Clarifies that collections must be empty to delete them --- source/rest-v2.html.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/source/rest-v2.html.md b/source/rest-v2.html.md index d7f800fb848..d7e826c31ab 100644 --- a/source/rest-v2.html.md +++ b/source/rest-v2.html.md @@ -828,6 +828,47 @@ The following fields need to be sent within a collection scope (see the right pa | ----- | ------ | -------- | ---------------- | | title | String | Yes | Collection Title | +## Delete a collection + +### HTTP Request + +`DELETE https://api.publitas.com/v2/groups//collections/` + +### URL Parameters + +| Parameter | Description | +| ------------- | -------------------------- | +| Group ID | The ID of a specific group | +| Collection ID | The ID of the collection to delete | + +```shell +curl -X DELETE "https://api.publitas.com/v2/groups/1/collections/42" \ + -H "Authorization: ApiKey " +``` + +### Response codes + +| Code | Description | +| ---- | ----------- | +| 204 | No Content - Collection successfully deleted | +| 403 | Forbidden - Invalid API key or insufficient permissions | +| 404 | Not Found - Collection does not exist | +| 409 | Conflict - Collection cannot be deleted because it contains publications | + +### Error responses + +When a collection cannot be deleted because it contains publications, the API returns a 409 Conflict status with the following error message: + +```json +{ + "error": "You can't delete this collection. It must be empty." +} +``` + + + # Pages ## Add pages to publication From 89d85ad062b13a53238eec5ce6a622762e28388c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karlo=20=C5=A0imunovi=C4=87?= Date: Thu, 4 Sep 2025 11:34:30 +0200 Subject: [PATCH 2/2] Clarify collection deletion criteria in documentation Remove misleading information regarding the deletion of collections with offline publications. This change ensures that the documentation accurately reflects the API's behavior and reduces potential confusion for users. - Updated the notice to specify that collections with publications cannot be deleted. - Enhanced clarity and consistency in API documentation. --- source/rest-v2.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/rest-v2.html.md b/source/rest-v2.html.md index d7e826c31ab..66360baf150 100644 --- a/source/rest-v2.html.md +++ b/source/rest-v2.html.md @@ -866,7 +866,7 @@ When a collection cannot be deleted because it contains publications, the API re ``` # Pages