Api >

Service Portal REST API

Create Unprovisioned Sip with all data set
Given I am authenticated as admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 201 Created with http://localhost:9998/api/customers/K0002/devices/unprovisioned-sip/device123
with following body:
{
  "href": "/api/customers/K0002/devices/unprovisioned-sip/device123"
}
Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/unprovisioned-sip/device123
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/unprovisioned-sip/device123",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Admin can create Unprovisioned Sip Device with optional data
Given I am authenticated as admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
When I send /api/customers/K0002/devices/unprovisioned-sip/device123
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/devices/unprovisioned-sip/device123",
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/1"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Admin cannot use site from another Customer when creating device
Given I am authenticated as admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and next Site ID will be 360
and there is a site with ID anotherSite for customer K0003
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0003/sites/anotherSite"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
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": "Site not allowed",
    "detailMessage": "Site [anotherSite] is not reachable for customer [K0002]",
    "path": "site",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Cannot create Device if it will break Customer's Contract constraints
Given I am authenticated as Admin
and there is another customer K0003
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
my Contract does not allow me to add more Devices
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0003/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0003/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0003/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Customer contract type does not allow to add more Devices"
  }]
}
Cannot create Unprovisioned Sip with duplicated ID
Given I am authenticated as admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as admin
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Unique Identifier is not unique",
    "path": "uniqueIdentifier",
    "value": "device123"
  }]
}
Cannot create Unprovisioned Sip with missing ID
Given I am authenticated as admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }]
}
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": "uniqueIdentifier must not be null or empty",
    "path": "uniqueIdentifier",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Cannot create Unprovisioned SIP device with wrong device type
Given I am authenticated as Admin
and there is a FMC Device Type with name fmc
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/fmc"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Cannot create Unprovisioned Sip Device with type that is not Unprovisioned Sip category",
    "path": "deviceType",
    "value": "/api/customers/K0002/device-types/fmc"
  }]
}
Admin Cannot create Unprovisioned SIP device with not existing Device Type
Given I am authenticated as Admin
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/not_existing"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body
{
  "title": "Device Type not found",
  "detail": "Device Type with name not_existing not found",
  "described_by": "http://api.nfon.net/probs/device-type-not-found"
}
Admin cannot create Unprovisioned SIP device with not existing Site
Given I am authenticated as Admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/not-existing"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
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"
}
Admin cannot create Unprovisioned SIP device for missing Customer
Given I am authenticated as Admin
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0404/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
with following body
{
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Not Admin cannot create Unprovisioned Sip Device
Given I am authenticated as customer K0002
and there is an UnprovisionedSip Device Type with name unprovisioned_sip
and there is a site with ID a062000000HbAsd
When I send /api/customers/K0002/devices/unprovisioned-sip with application/json; charset=UTF-8
and following body:
{
  "links": [{
    "rel": "deviceType",
    "href": "/api/customers/K0002/device-types/unprovisioned_sip"
  }, {
    "rel": "site",
    "href": "/api/customers/K0002/sites/a062000000HbAsd"
  }],
  "data": [{
    "name": "uniqueIdentifier",
    "value": "device123"
  }]
}
Then I should get HTTP/1.1 403 Forbidden
{
  "detail": "Access denied to [DeviceType] with id [unprovisioned_sip]",
  "title": "Access forbidden",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}