Api >

Service Portal REST API

GET Returns Operator Panel Device
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab 01-23-45-67-89-ab with status active with assigned Firmware 150.123
With assigned site Berlin(salesforceID: 54526563554535)
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab using application/json; charset=UTF-8
Then I should receive HTTP/1.1 200 OK With following body:
{
  "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/nreception"
  }, {
    "rel": "extension",
    "href": null
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/150.123"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab/activate"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/54526563554535"
  }],
  "data": [{
    "name": "macAddress",
    "value": "01-23-45-67-89-ab"
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "note",
    "value": null
  }]
}
GET returns preferred firmware for device with null firmware
Given I am authenticated as K0002
And there is Operator Panel Type with name nreception
which has preferred firmware with version 01.56
And there is Operator Panel Device with Id 01-23-45-67-89-ab which has no firmware assigned
When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab",
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/01.56"
  }]
}
GET returns 404 when Operator Panel does not exist
Given I am authenticated as customer K0002
And there is no Operator Panel with id 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab
Then I should get HTTP/1.1 404 Not Found with body
{
  "title": "Device not found",
  "detail": "Device with unique identifier 01-23-45-67-89-ab has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/operator-panel/01-23-45-67-89-ab
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"
}
GET returns 403 Forbidden when Customer tries to retrieve other Customer's Operator Panel
Given I am authenticated as K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab for Customer K0003 When I /api/customers/K0003/devices/operator-panel/01-23-45-67-89-ab
Then I should get HTTP/1.1 403 Forbidden with body
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0003]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System integrator can see sipUsername
Given I am authenticated as System Integrator S0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab 01-23-45-67-89-ab with status active with assigned Firmware 150.123
With assigned site Berlin(salesforceID: 54526563554535)
When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab using application/json; charset=UTF-8
Then I should receive HTTP/1.1 200 OK With following body:
{
  "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/nreception"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/150.123"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab/activate"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/54526563554535"
  }],
  "data": [{
    "name": "macAddress",
    "value": "01-23-45-67-89-ab"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }]
}
Operator can see sipSecret
Given I am authenticated as Operator C0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab 01-23-45-67-89-ab with status active with assigned Firmware 150.123
With assigned site Berlin(salesforceID: 54526563554535)
and Operator Panel has sipSecret set to kSIzxm76EE2
which has been created at 2015-10-12 04:25 When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab using application/json; charset=UTF-8
Then I should receive HTTP/1.1 200 OK With following body:
{
  "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/nreception"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/150.123"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab/activate"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/54526563554535"
  }],
  "data": [{
    "name": "macAddress",
    "value": "01-23-45-67-89-ab"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "sipSecret",
    "value": "kSIzxm76EE2"
  }]
}
System Integrator cannot access Operator Panel Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/operator-panel/01-23-45-67-89-ab
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 access Operator Panel Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/operator-panel/01-23-45-67-89-ab
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"
}