Api >

Service Portal REST API

PUT deactivates Handset
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has Handset with port Port0 which is active
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content
And Handset with ID ABCDEF012345-Port0 is deactivated
PUT activates Handset
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has Handset with port Port0 which is inactive
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
And Handset with ID ABCDEF012345-Port0 is activated
PUT doesn't allow to activate/deactivate non-existing device
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it does not have a Handset with port 404
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/404/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should receive HTTP/1.1 404 Not Found
{
  "title": "Device not found",
  "detail": "Device with unique identifier 404 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
PUT doesn't allow to activate/deactivate device of incorrect type
Given I am authenticated as K0002
And I have Operator Panel Device with Mac Address 01-23-45-67-89-ab When I send /api/customers/K0002/devices/base/01-23-45-67-89/handsets/ab/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should receive HTTP/1.1 404 Not Found
{
  "title": "Device not found",
  "detail": "Device with unique identifier ab has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Admin cannot activate/deactivate device of missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/base/ABCDEF012345/handsets/Port0/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should receive HTTP/1.1 404 Not Found
{
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
PUT doesn't allow to activate/deactivate device which belongs to other customer
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 that belongs to the Customer K0003
and it has Handset with port Port0
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should get HTTP/1.1 404 Not Found with body
{
  "title": "Device not found",
  "detail": "Device with unique identifier Port0 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
PUT doesn't allow to activate device if it will break Customer's Contract constraints
Given I am authenticated as K0003
And there is a Base Device with MAC ABCDEF012345
and it has Handset with port Port0 which is deactivated
and my Contract does not allow me to add more Devices When I send /api/customers/K0003/devices/base/ABCDEF012345/handsets/Port0/activate using application/json; charset=UTF-8
with following body:
{
  "data": [{
    "name": "active",
    "value": true
  }]
}
Then I should get HTTP/1.1 400 Bad Request with body
{
  "title": "Validation error",
  "detail": "Could not create or update resource due to constraint violations",
  "errors": [{
    "message": "Customer contract type does not allow to add more Devices"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
System Integrator cannot activate Handset 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/handsets/Port0/activate
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 activate Handset of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/base/ABCDEF012345/handsets/Port0/activate
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"
}