Stub API. Stubs Delete
The /api/stubs/{uuid} endpoint with the DELETE method removes a specific stub by its unique identifier (UUID).
Request
- Method:
DELETE - URL:
/api/stubs/{uuid} - Parameters:
uuid(path parameter): The ID of the stub to delete (UUID format).
- Headers: Standard headers (e.g.,
Content-Type: application/json).
Example Request:
bash
curl -X DELETE http://127.0.0.1:4771/api/stubs/6c85b0fa-caaf-4640-a672-f56b7dd8074dResponse
Success:
- Status Code:
204 No Content - Body: Empty (no content returned).
- Status Code:
Error:
- Status Code:
404 Not Found(if the stub does not exist). - Body:json
{ "error": "Stub with ID '6c85b0fa-caaf-4640-a672-f56b7dd8074d' not found" }
- Status Code:
Behavior
- Idempotency:
- Returns
204even if the stub does not exist (no error).
- Returns
- Impact on Lists:
- If the stub was marked as "used" or "unused," it is removed from both
/api/stubs/usedand/api/stubs/unused.
- If the stub was marked as "used" or "unused," it is removed from both
Example Workflow
Create a Stub:
bashcurl -X POST -d '{ "service": "Gripmock", "method": "SayHello", "input": { "equals": { "name": "gripmock" } } }' http://127.0.0.1:4771/api/stubsResponse:
json["6c85b0fa-caaf-4640-a672-f56b7dd8074d"]Delete the Stub:
bashcurl -X DELETE http://127.0.0.1:4771/api/stubs/6c85b0fa-caaf-4640-a672-f56b7dd8074dResponse:
204 No ContentVerify Deletion:
bashcurl http://127.0.0.1:4771/api/stubs/6c85b0fa-caaf-4640-a672-f56b7dd8074dResponse:
httpHTTP/1.1 404 Not Found Content-Type: application/json Date: Fri, 04 Apr 2025 22:31:30 GMT Content-Length: 0 { "error": "Stub with ID '6c85b0fa-caaf-4640-a672-f56b7dd8074d' not found" }
Notes
- Edge Cases:
- Deleting a non-existent stub does not return an error (idempotent operation).
- Use
GET /api/stubs/{uuid}to verify existence before deletion.
- Related Endpoints:
DELETE /api/stubs: Purge all stubs.POST /api/stubs: Create or update stubs.GET /api/stubs/usedandGET /api/stubs/unused: Track stub usage.
Schema References
For complete schema details, see:
This endpoint is critical for precise management of stubs during testing. Use it to remove outdated or redundant configurations.