Api >

Service Portal REST API

PUT updates provided fields
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
Then I should get HTTP/1.1 204 No Content
And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
PUT updates note property
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
Then I should receive HTTP/1.1 204 No Content

And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
PUT deletes Handset Device note property if empty value is given
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "note",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 204 No Content

And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT deletes Handset Device note property if null value is given
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
Then I should receive HTTP/1.1 204 No Content

And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT updates provided links
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
And there is Site Berlin (salesforceID: 54526563554535 And there is Firmware 555.321 available for this Device When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/555.321"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/54526563554535"
  }]
}
Then I should get HTTP/1.1 204 No Content
And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/nreception/firmwares/555.321"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/54526563554535"
  }]
}
PUT unsets license
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
with license Brand new license
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "license",
    "value": ""
  }]
}
Then I should get HTTP/1.1 204 No Content
And /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab returns:
{
  "data": [{
    "name": "license",
    "value": ""
  }]
}
PUT does not update firmware, if it doesn't fit the Device Type
Given I am authenticated as customer K0002
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
and there is a 150.123 Firmware for OtherDeviceType
When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json; charset=UTF-8) with following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/OtherDeviceType/firmwares/150.123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Firmware is invalid for selected device type",
    "detailMessage": "Provided firmware with releaseVersion 150.123 is invalid for device with type nreception",
    "path": "firmware"
  }]
}
PUT does not update site, if it is not accessible by the Customer
Given I am authenticated as Admin
And there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
and there is a a062000000K0003 Site that belongs to Customer K0003 When I send /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json; charset=UTF-8) with following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0003/sites/a062000000K0003"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Site not allowed",
    "detailMessage": "Site [a062000000K0003] is not reachable for customer [K0002]",
    "path": "site"
  }]
}
Cannot update Operator Panel for missing Customer
Given I am authenticated as Admin
When I /api/customers/K0404/devices/operator-panel/01-23-45-67-89-ab using application/json;charset=UTF-8
with body
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }]
}
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"
}
Customer cannot change other Customer's Operator Panel
Given I am authenticated as K0003
and there is Operator Panel Device with Mac Address 01-23-45-67-89-ab
When I /api/customers/K0002/devices/operator-panel/01-23-45-67-89-ab (using application/json;charset=UTF-8) with body
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }]
}
Then I should get HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot update Operator Panel of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I /api/customers/K0003/devices/operator-panel/01-23-45-67-89-ab using application/json;charset=UTF-8
with body
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }]
}
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 update Operator Panel of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I /api/customers/K0003/devices/operator-panel/01-23-45-67-89-ab using application/json;charset=UTF-8
with body
{
  "data": [{
    "name": "license",
    "value": "newLicenseKey"
  }]
}
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"
}