Api >

Service Portal REST API

PUT can update Standard Device's properties
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
which has
  • External Ringtone maximum numbers set to 5
  • Internal Ringtone maximum numbers set to 5
And there is a site with ID a062000000HbAsd
And there is firmware with version 01.49
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }],
  "data": [{
    "name": "ringtoneInternal",
    "value": 3
  }, {
    "name": "ringtoneExternal",
    "value": 2
  }, {
    "name": "groupQueueSkillRingtone",
    "value": 2
  }, {
    "name": "useSiteOptionsFromSite",
    "value": true
  }, {
    "name": "webguiHttpsonly",
    "value": true
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }],
  "data": [{
    "name": "ringtoneInternal",
    "value": 3
  }, {
    "name": "ringtoneExternal",
    "value": 2
  }, {
    "name": "groupQueueSkillRingtone",
    "value": 2
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
PUT updates Standard Device's note property
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
PUT doesn't update Standard Device's note property if length is greater than 255
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "Phone note value length is limited to: 255 characters.",
    "path": "note",
    "value": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
PUT deletes Standard Device's note property if empty value is given
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT deletes Standard Device's note property if null value is given
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT deletes Standard Device's note property if empty value is given after note value has been changed already
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "note",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT creates new SiteOptions entity when updating useSiteOptionsFromSite from true to false
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "useSiteOptionsFromSite",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }],
  "data": [{
    "name": "useSiteOptionsFromSite",
    "value": false
  }]
}

Given I am authenticated as customer K0002
When I send /api/customers/K0002/sites/1/site-options
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "0"
  }]
}

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc/site-options
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "0"
  }]
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc/site-options with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "9"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc/site-options
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "9"
  }]
}

Given I am authenticated as customer K0002
When I send /api/customers/K0002/sites/1/site-options
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "0"
  }]
}
Cannot edit not existing device
Given I am authenticated as customer K0002
And there is no Standard device with id ABCDEF012345
When I send /api/customers/K0002/devices/standard/ABCDEF012345 with application/json; charset=UTF-8
and following body:
{}
Then I should receive HTTP/1.1 404 Not Found 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"
}
Admin cannot update Standard Device for not existing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/standard/device123 with application/json; charset=UTF-8
and following body:
{}
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"
}
Admin cannot update site for another Customer
Given I am authenticated as admin
and next Site ID will be 360
and there is a site with ID a062000000HbAsd
and there is a Standard Device with ID 123456789abc and name standard for Customer K0003
When I send /api/customers/K0003/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Site not allowed",
    "detailMessage": "Site [a062000000HbAsd] is not reachable for customer [K0003]",
    "path": "site"
  }]
}

Given I am authenticated as customer K0003
When I send /api/customers/K0003/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0003/sites/1"
  }]
}
Cannot update with not existing Site
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/not_existing"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "detail": "Site [not_existing] not found for Customer [K0002]",
  "described_by": "http://api.nfon.net/probs/site-not-found"
}
Should not change site to default Mobile Site
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and it has assigned a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/standard/123456789abc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/standard/123456789abc",
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "123456789abc"
  }]
}
Cannot edit not existing device
Given I am authenticated as customer K0002
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "title": "Device not found",
  "detail": "Device with unique identifier 123456789abc has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Update Standard Device with not accessible Firmware
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a beta firmware with version 01.49-beta
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49-beta"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Firmware] with id [01.49-beta]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Update Standard Device with not accessible Firmware
Given I am authenticated as System Integrator S0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a beta firmware with version 01.49-beta
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49-beta"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Firmware] with id [01.49-beta]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Update Standard Device with not accessible Firmware
Given I am authenticated as Operator C0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a beta firmware with version 01.49-beta
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49-beta"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Firmware] with id [01.49-beta]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Update Standard Device with not accessible Firmware
Given I am authenticated as Admin
and there is a Standard Device with ID 123456789abc and name standard
And there is a beta firmware with version 01.49-beta
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49-beta"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update Standard Device with accessible Firmware
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a firmware with version 01.49
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update Standard Device with accessible Firmware
Given I am authenticated as System Integrator S0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a firmware with version 01.49
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update Standard Device with accessible Firmware
Given I am authenticated as Operator C0002
and there is a Standard Device with ID 123456789abc and name standard
And there is a firmware with version 01.49
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update Standard Device with accessible Firmware
Given I am authenticated as Admin
and there is a Standard Device with ID 123456789abc and name standard
And there is a firmware with version 01.49
When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.49"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Cannot update Standard Device with ringtoneExternal if it's rejected
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and External Ringtone maximum numbers is set to 0 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "ringtoneExternal",
    "value": 2
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Field not allowed for device type or selected firmware",
    "path": "ringtoneExternal"
  }]
}
Cannot update Standard Device with ringtoneInternal if it's rejected
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and Internal Ringtone maximum numbers is set to 0 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "ringtoneInternal",
    "value": 0
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Field not allowed for device type or selected firmware",
    "path": "ringtoneInternal"
  }]
}
Cannot update Standard Device with groupQueueSkillRingtone if it's rejected
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and Internal Ringtone maximum numbers is set to 0 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "groupQueueSkillRingtone",
    "value": 0
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Field not allowed for device type or selected firmware",
    "path": "groupQueueSkillRingtone"
  }]
}
Cannot update Standard Device with invalid ringtoneInternal
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and Internal Ringtone maximum numbers is set to 5 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "ringtoneInternal",
    "value": 77
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Invalid value for Ringtone. Allowed values are 0-5",
    "path": "ringtoneInternal"
  }]
}
Cannot update Standard Device with invalid ringtoneExternal
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and External Ringtone maximum numbers is set to 5 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "ringtoneExternal",
    "value": 77
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Invalid value for Ringtone. Allowed values are 0-5",
    "path": "ringtoneExternal"
  }]
}
Cannot update Standard Device with invalid groupQueueSkillRingtone
Given I am authenticated as customer K0002
and there is a Standard Device with ID 123456789abc and name standard
and GroupQueueSkill Ringtone maximum numbers is set to 5 When I send /api/customers/K0002/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "data": [{
    "name": "groupQueueSkillRingtone",
    "value": 77
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Invalid value for Ringtone. Allowed values are 0-5",
    "path": "groupQueueSkillRingtone"
  }]
}
Customer cannot update not his Device
Given I am authenticated as customer K0002
and there is a site with ID a062000000HbAsd
and there is a Standard Device with ID 123456789abc and name standard
assigned to Customer K0003
When I send /api/customers/K0003/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }]
}
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"
}
System Integrator cannot update Standard Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{}
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 Standard Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/standard/123456789abc with application/json; charset=UTF-8
and following body:
{}
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"
}