Skip to main content

Delete Product Unit

Delete a product unit from the system. This operation is permanent and cannot be undone. Consider disabling units instead of deleting them if historical tracking is required.

⚠️ Pre-deletion Checks

The system performs these checks before deletion:

  1. Unit disabled status
  2. User group associations
  3. Related dependencies
  4. Historical data requirements

📤 Request Format

DELETE /api/v1/units/UNIT-123
Authorization: ONLIVESITE Credential:ONLIVEAccessKeyId, Signature=CalculatedSignature

📥 Response Format

Success Response

HTTP/1.1 204 No Content

Error Responses

Unit Not Found (404 Not Found)

{
"statusCode": 404,
"message": "Product unit not found"
}

Unit Still Active (422 Unprocessable Entity)

{
"statusCode": 422,
"message": "Cannot delete an active unit",
"errors": [
{
"field": "disabled",
"message": "Unit must be disabled before deletion"
}
]
}

Deletion Restricted (403 Forbidden)

{
"statusCode": 403,
"message": "Unit deletion is restricted",
"errors": [
{
"reason": "historical_data_required",
"message": "Unit has historical data that must be preserved"
}
]
}

🔒 Required Permissions

  • units:delete
  • units:manage (for force deletion)

💡 Tips and Best Practices

Before Deletion

  1. Check unit disabled status
  2. Review user group associations
  3. Consider historical data needs
  4. Document deletion reason
  5. Backup relevant data

Alternative Actions

  • Disable the unit (disabled: true)
  • Remove user group association
  • Archive unit data
  • Update metadata

Common Use Cases

  • Removing test units
  • Cleaning up inactive units
  • Removing duplicate entries
  • Managing development instances

⚠️ Important Notes

  1. Permanent Action

    • Deletion cannot be undone
    • Historical data is lost
    • Related records may be affected
  2. Alternative Options

    • Consider disabling instead
    • Remove associations
    • Archive if needed
  3. Impact Assessment

    • Check dependencies
    • Review associations
    • Validate data requirements
  4. Compliance

    • Follow data retention policies
    • Document deletion reasons
    • Maintain audit trails