Api >

Service Portal REST API

DELETE removes Base Device
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 which is deactivated
When I send /api/customers/K0002/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 204 No Content
and there should be no device with MAC ABCDEF012345
DELETE does not remove active Base Device
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 which is activated
When I send /api/customers/K0002/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 400 Bad Request
{
  "errors": [{
    "message": "Cannot delete active device"
  }]
}
DELETE does not remove Base Device if it has handsets assigned
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 which is deactivated
and it has Handset with port 0123456789AB
When I send /api/customers/K0002/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 400 Bad Request
{
  "title": "Validation error",
  "detail": "Could not create or update resource due to constraint violations",
  "errors": [{
    "message": "Cannot delete base device if it has handsets assigned"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
DELETE does not remove Base Device if Customer's contract does not allow it
Given I am authenticated as K0003
And there is a Base Device with MAC ABCDEF012345 which is deactivated
and my Contract does not allow me to delete ABCDEF012345 Device
When I send /api/customers/K0003/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 400 Bad Request
{
  "errors": [{
    "message": "Cannot delete device because of Customer's contract"
  }]
}
Cannot DELETE Device for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "described_by": "http://api.nfon.net/probs/customer-not-found",
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found"
}
Cannot DELETE Device of another Customer
Given I am authenticated as customer K0003
When I send /api/customers/K0002/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot delete Base Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot delete Base Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/base/ABCDEF012345
Then I should receive HTTP/1.1 403 Forbidden
with following body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}