Api >

Service Portal REST API

GET retrieves list of Devices attached to Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345 which is attached to Phone Extension
and there is a DeviceType[924] device with Id ABCDEF012390 which is not attached to Phone Extension
And there is a Base Device with MAC ABCDEF333333
and it has active Handset with port Port0 which is attached to Phone Extension
When I send /api/customers/K0002/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/201/devices?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345",
    "links": [{
      "rel": "deletion",
      "href": "/api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345"
    }],
    "data": [{
      "name": "deviceType",
      "value": "standard"
    }, {
      "name": "deviceId",
      "value": "ABCDEF012345"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF012345"
    }, {
      "name": "extension",
      "value": "201"
    }, {
      "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"
    }]
  }, {
    "href": "/api/customers/K0002/devices/base/ABCDEF333333/handsets/Port0",
    "links": [{
      "rel": "deletion",
      "href": "/api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF333333-Port0"
    }],
    "data": [{
      "name": "deviceType",
      "value": "Handset for Base Device"
    }, {
      "name": "deviceId",
      "value": "ABCDEF333333-Port0"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF333333-Port0"
    }, {
      "name": "extension",
      "value": "201"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "HANDSET"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "HANDSET"
    }, {
      "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"
    }]
  }]
}
GET retrieves filtered list of Devices attached to Phone Extension
Filtering is done on field:
  • uniqueIdentifier
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a standard device with Id ABCDEF012345 which is attached to Phone Extension
And there is a Base Device with MAC ABCDEF333333
and it has active Handset with port Port0 which is attached to Phone Extension
When I send /api/customers/K0002/targets/phone-extensions/201/devices?_q=12345
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/201/devices?_offset=0&_pagesize=16&_q=12345",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345",
    "links": [{
      "rel": "deletion",
      "href": "/api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345"
    }],
    "data": [{
      "name": "deviceType",
      "value": "standard"
    }, {
      "name": "deviceId",
      "value": "ABCDEF012345"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF012345"
    }, {
      "name": "extension",
      "value": "201"
    }, {
      "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"
    }]
  }]
}
GET retrieves XCAPI device attached to Phone Extension
Given I am authenticated as Customer K0002
and there is a Phone Extension with extension number 201
and there is a XCAPI device with Id ABCDEF012345 which is attached to Phone Extension
and there is a Phone Extension with extension number 402
and there is a XCAPI device with Id ABCDEF012346 which is attached to Phone Extension
When I send /api/customers/K0002/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/phone-extensions/201/devices?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/xcapi/ABCDEF012345",
    "links": [{
      "rel": "deletion",
      "href": "/api/customers/K0002/targets/phone-extensions/201/devices/ABCDEF012345"
    }],
    "data": [{
      "name": "deviceType",
      "value": "XCAPI"
    }, {
      "name": "deviceId",
      "value": "ABCDEF012345"
    }, {
      "name": "uniqueIdentifier",
      "value": "ABCDEF012345"
    }, {
      "name": "extension",
      "value": "201"
    }, {
      "name": "active",
      "value": true
    }, {
      "name": "deviceMasterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "name": "deviceCategory",
      "value": "category"
    }, {
      "name": "masterCategory",
      "value": "UNPROVISIONED_SIP"
    }, {
      "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"
    }]
  }]
}
Cannot GET list of attached Devices for missing Customer
Given I am authenticated as admin
When I send /api/customers/K404/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Cannot GET list of attached Devices for missing Phone Extension
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/phone-extensions/404/devices
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "described_by": "http://api.nfon.net/probs/extension-not-found",
  "title": "Extension not found",
  "detail": "Extension with extension number 404 has not been found"
}
Missing customer
Given I am authenticated as admin
When I send /api/customers/K0404/targets/phone-extensions/201/devices Then I should get 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"
}
Customer cannot GET list of attached Devices for not his Phone Extension
Given there is a Phone Extension with extension number 201
and I am authenticated as customer K0003
When I send /api/customers/K0002/targets/phone-extensions/201/devices
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
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 cannot access Phone Extension Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/phone-extensions/201/devices
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 Phone Extension Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/phone-extensions/201/devices
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"
}