Api >

Service Portal REST API

DELETE removes Device attached to Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345 which is attached to Phone Extension
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer null
When I send /api/customers/K0002/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "items": []
}
DELETE removes XCAPI Device attached to Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a XCAPI device with Id ABCDEF000001 which is attached to Phone Extension
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF000001
Then I should receive HTTP/1.1 204 No Content
DELETE fails removing a lync device attached to the phone extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 17
and there is a Trunk with numbers +48 (22) 33-65
and there is an Inbound Trunk Number with extension 33
and it is assigned to phone extension
and there is a Lync Option with id 134
and there is a Lync Softphone Device attached
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/targets/phone-extensions/17/devices/1-48223333
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "A softphone device with unique identifier 1-48223333 cannot be removed from the PhoneExtension 17.",
  "title": "Softphone Device cannot be removed from the phone extension",
  "described_by": "http://api.nfon.net/probs/device-cannot-be-removed"
}
DELETE returns 400 if tries to remove primary Device attached to Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345 which is attached to Phone Extension and there is another device with Id ABCDEF012346 which is attached to Phone Extension
as primary device
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012346
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Please define a new primary device before removal"
  }]
}
DELETE removes primary Device if it is the only device attached to the Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345 which is attached to Phone Extension as primary device
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Customer null
When I send /api/customers/K0002/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "items": []
}
Admin Cannot DELETE attached Device for not existing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/phone-extensions/201/devices/404
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Cannot DELETE attached Device for not existing Phone Extension
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/phone-extensions/404/devices/404
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "described_by": "http://api.nfon.net/probs/extension-not-found",
  "title": "Extension not found",
  "detail": "Extension with extension number 404 has not been found"
}
Customer cannot DELETE attached Device for not his Phone Extension
Given there is a Phone Extension with extension number 201 for Customer K0002
and I am authenticated as customer K0003
When I send /api/customers/K0002/targets/phone-extensions/201/devices/404
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Cannot DELETE not existing attached device
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
When I send /api/customers/K0002/targets/phone-extensions/201/devices/404
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Device not found",
  "detail": "Device with unique identifier 404 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Customer cannot DELETE attached Device which belongs to other customer
Given there is a Phone Extension with extension number 201 for Customer K0002
and Customer K0003 has a device with ID ABCDEF012345
and I am authenticated as customer K0002
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Device not found",
  "detail": "Device with unique identifier ABCDEF012345 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Cannot detach not attached Device
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345
When I send /api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Device not associated to phone extension",
  "detail": "A device with unique identifier ABCDEF012345 is not associated to PhoneExtension 201",
  "described_by": "http://api.nfon.net/probs/device-not-associated"
}
System Integrator cannot detach Phone Extension Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/phone-extensions/201/devices/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 detach Phone Extension Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/phone-extensions/201/devices/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"
}