Api >

Service Portal REST API

GET returns Standard Device data
Given I am authenticated as K0002
and there is an Standard Device Type with ID 123456789abc of type type01
and with externalRingtone set to 2
and with internalRingtone set to 3
and with groupQueueSkillRingtone set to 3
and with useSiteOptionsFromSite set to false
and with authorisation PIN set to 375215
and with supportsAuthentication set to true
which has been created at 2015-10-12 04:25 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": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/type01"
  }, {
    "rel": "extension",
    "href": null
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/type01/firmwares/1.0"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/standard/123456789abc/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/standard/123456789abc/site-options"
  }, {
    "rel": "bypassAuthentication",
    "href": "/api/customers/K0002/devices/123456789abc/bypass-authentication"
  }, {
    "rel": "resetAthentication",
    "href": "/api/customers/K0002/devices/123456789abc/reset-authentication"
  }],
  "data": [{
    "name": "deviceType",
    "value": "type01"
  }, {
    "name": "deviceId",
    "value": "123456789abc"
  }, {
    "name": "uniqueIdentifier",
    "value": "123456789abc"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "deviceMasterCategory",
    "value": "STANDARD"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }, {
    "name": "masterCategory",
    "value": "STANDARD"
  }, {
    "name": "category",
    "value": "category"
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "siteName",
    "value": "Dummy site K0002"
  }, {
    "name": "siteStreet",
    "value": ""
  }, {
    "name": "siteZip",
    "value": ""
  }, {
    "name": "siteCity",
    "value": ""
  }, {
    "name": "siteState",
    "value": null
  }, {
    "name": "siteCountry",
    "value": ""
  }, {
    "name": "siteSalesForceId",
    "value": "1"
  }, {
    "name": "note",
    "value": null
  }, {
    "name": "ringtoneExternal",
    "value": 2
  }, {
    "name": "ringtoneInternal",
    "value": 3
  }, {
    "name": "groupQueueSkillRingtone",
    "value": 3
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }, {
    "name": "webguiHttpsonly",
    "value": false
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }, {
    "name": "supportsAuthentication",
    "value": true
  }, {
    "name": "authenticationPIN",
    "value": "375215"
  }, {
    "name": "authenticationStatus",
    "value": "AuthenticationNecessaryVoice"
  }]
}
GET returns preferred firmware for devices with null firmware
Given I am authenticated as K0002
And there is a Standard Type with name standard
which has preferred firmware with version 01.56
And there is Standard Device with Id 123456789abc which has no firmware assigned
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": "firmware",
    "href": "/api/customers/K0002/device-types/standard/firmwares/01.56"
  }]
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/standard/00123
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"
}
Cannot read data for missing 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
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"
}
Customer cannot read another Customer device data
Given I am authenticated as customer K0003
When I send /api/customers/K0002/devices/standard/00123
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "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 an Standard Device Type with ID 123456789abc of type type01
and with externalRingtone set to 2
and with internalRingtone set to 3
and with groupQueueSkillRingtone set to 3
and with useSiteOptionsFromSite set to false
which has been created at 2015-10-12 04:25 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": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/type01"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/type01/firmwares/1.0"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/standard/123456789abc/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/standard/123456789abc/site-options"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "123456789abc"
  }, {
    "name": "ringtoneExternal",
    "value": 2
  }, {
    "name": "ringtoneInternal",
    "value": 3
  }, {
    "name": "groupQueueSkillRingtone",
    "value": 3
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }, {
    "name": "webguiHttpsonly",
    "value": false
  }, {
    "name": "deviceType",
    "value": "type01"
  }, {
    "name": "deviceId",
    "value": "123456789abc"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "deviceMasterCategory",
    "value": "STANDARD"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }]
}
Operator can see sipSecret
Given I am authenticated as Operator C0002
and there is an Standard Device Type with ID 123456789abc of type type01
and with externalRingtone set to 2
and with internalRingtone set to 3
and with groupQueueSkillRingtone set to 3
and it has sipSecret set to kSIzxm76EE2
and with useSiteOptionsFromSite set to false
which has been created at 2015-10-12 04:25 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": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/type01"
  }, {
    "rel": "firmware",
    "href": "/api/customers/K0002/device-types/type01/firmwares/1.0"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/standard/123456789abc/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/standard/123456789abc/site-options"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "123456789abc"
  }, {
    "name": "ringtoneExternal",
    "value": 2
  }, {
    "name": "ringtoneInternal",
    "value": 3
  }, {
    "name": "groupQueueSkillRingtone",
    "value": 3
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }, {
    "name": "webguiHttpsonly",
    "value": false
  }, {
    "name": "deviceType",
    "value": "type01"
  }, {
    "name": "deviceId",
    "value": "123456789abc"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "sipSecret",
    "value": "kSIzxm76EE2"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "site",
    "value": "Dummy site K0002"
  }, {
    "name": "deviceMasterCategory",
    "value": "STANDARD"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }]
}
System Integrator cannot access 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
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 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
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"
}