-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Problem description
Related to review comments included with PR #73
The API currently uses the PATCH method for bulk insert, remove, and replace operations on resource relationships. For example:
PATCH /devices/{deviceId}/isolated-networks # Bulk update networks
PATCH /isolated-networks/{netId}/devices # Bulk update devicesAccording to CAMARA guidelines, PATCH should only be used to modify the resource itself, not to manage relationships between resources. Using PATCH in this way can lead to confusion and non-standard API behavior.
Expected behavior
The API should use POST and DELETE methods for managing relationships between resources. For example:
POST /devices/{deviceId}/isolated-networks # Add networks
DELETE /devices/{deviceId}/isolated-networks # Remove networks
# Add multiple networks
POST /devices/{deviceId}/networks
Content-Type: application/json
{
"networkIds": ["net1", "net2"]
}
# Remove multiple networks
DELETE /devices/{deviceId}/networks
Content-Type: application/json
{
"networkIds": ["net3", "net4"]
}
This approach aligns with CAMARA guidelines and standard RESTful practices.
Alternative solution
If bulk operations are required, perhaps consider using batch endpoints with POST and DELETE, or provide separate endpoints for each operation type, while still avoiding PATCH for relationship management.
Additional context
This issue was identified during the CAMARA design review. Aligning HTTP method usage with CAMARA guidelines will improve API clarity, interoperability, and ease of client implementation.