Api >

Service Portal REST API

GET returns External Line Device data
Given I am authenticated as K0002
and there is a External Line device with ID device123 and an associatedMobilePhoneNumber +1232456789 and with useSiteOptionsFromSite set to false
and setE164DidInTo is set true and cidScreening is set ALLOW_ANY When I send /api/customers/K0002/devices/external-line/device123
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/external-line/device123",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/External%20Line"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/external-line/device123/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/external-line/device123/site-options"
  }],
  "data": [{
    "name": "deviceType",
    "value": "External Line"
  }, {
    "name": "deviceId",
    "value": "device123"
  }, {
    "name": "uniqueIdentifier",
    "value": "device123"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "deviceMasterCategory",
    "value": "FMC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }, {
    "name": "masterCategory",
    "value": "FMC"
  }, {
    "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": "associatedMobilePhoneNumber",
    "value": "+1232456789"
  }, {
    "name": "note",
    "value": null
  }, {
    "name": "concurrentLines",
    "value": 5
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }, {
    "name": "setE164DidInTo",
    "value": true
  }, {
    "name": "cidScreening",
    "value": "ALLOW_EXTENSION_DID"
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }]
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/external-line/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 a External Line device with ID device123 and an associatedMobilePhoneNumber +01232456789 When I send /api/customers/K0002/devices/external-line/ABCDEF01234
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Device with unique identifier ABCDEF01234 has not been found",
  "title": "Device not found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Customer cannot GET other Customer's External Line device data
Given I am authenticated as customer K0003
and there is a External Line device with ID device123 and an associatedMobilePhoneNumber +01232456789 When I send /api/customers/K0002/devices/external-line/device123
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 can see sipUsername
Given I am authenticated as System Integrator S0002
and there is a External Line device with ID device123 and an associatedMobilePhoneNumber +01232456789 and with useSiteOptionsFromSite set to false
When I send /api/customers/K0002/devices/external-line/device123
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/external-line/device123",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/External%20Line"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/external-line/device123/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/external-line/device123/site-options"
  }],
  "data": [{
    "name": "deviceType",
    "value": "External Line"
  }, {
    "name": "deviceId",
    "value": "device123"
  }, {
    "name": "uniqueIdentifier",
    "value": "device123"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "deviceMasterCategory",
    "value": "FMC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }, {
    "name": "masterCategory",
    "value": "FMC"
  }, {
    "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": "associatedMobilePhoneNumber",
    "value": "+01232456789"
  }, {
    "name": "note",
    "value": null
  }, {
    "name": "concurrentLines",
    "value": 5
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }]
}
Operator can see sipSecret
Given I am authenticated as Operator C0002
and there is a External Line device with ID device123 and an associatedMobilePhoneNumber +01232456789 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/external-line/device123
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/devices/external-line/device123",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/External%20Line"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "activation",
    "href": "/api/customers/K0002/devices/external-line/device123/activate"
  }, {
    "rel": "siteOptions",
    "href": "/api/customers/K0002/devices/external-line/device123/site-options"
  }],
  "data": [{
    "name": "deviceType",
    "value": "External Line"
  }, {
    "name": "deviceId",
    "value": "device123"
  }, {
    "name": "uniqueIdentifier",
    "value": "device123"
  }, {
    "name": "extension",
    "value": ""
  }, {
    "name": "sipUsername",
    "value": "K0002"
  }, {
    "name": "sipSecret",
    "value": "kSIzxm76EE2"
  }, {
    "name": "created",
    "value": "2015-10-12 04:25"
  }, {
    "name": "active",
    "value": true
  }, {
    "name": "deviceMasterCategory",
    "value": "FMC"
  }, {
    "name": "deviceCategory",
    "value": "category"
  }, {
    "name": "masterCategory",
    "value": "FMC"
  }, {
    "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": "associatedMobilePhoneNumber",
    "value": "+01232456789"
  }, {
    "name": "note",
    "value": null
  }, {
    "name": "concurrentLines",
    "value": 5
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }, {
    "name": "useSiteOptionsFromSite",
    "value": false
  }]
}
System Integrator cannot access External Line Device of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/devices/external-line/device123
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 External Line Device of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/external-line/device123
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"
}