Api >

Service Portal REST API

GET returns Licenses for given Base Device
Given I am authenticated as K0002
and there is a Base Device of category Kirk with MAC ABCDEF012345
and Port Type IPEI
that has a license with key License Key and type License Type and id 12
and another license with key Another License Key and type Another License Type and id 13
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys
Then I should receive HTTP/1.1 200 OK and following body:
{
  "href": "/api/customers/K0002/devices/base/ABCDEF012345/license-keys?_offset=0&_pagesize=16",
  "offset": 0,
  "size": 2,
  "total": 2,
  "items": [{
    "href": "/api/customers/K0002/devices/base/ABCDEF012345/license-keys/12",
    "data": [{
      "name": "licenseKey",
      "value": "License Key"
    }, {
      "name": "licenseType",
      "value": "License Type"
    }]
  }, {
    "href": "/api/customers/K0002/devices/base/ABCDEF012345/license-keys/13",
    "data": [{
      "name": "licenseKey",
      "value": "Another License Key"
    }, {
      "name": "licenseType",
      "value": "Another License Type"
    }]
  }]
}
GET returns filtered Licenses for given Base Device
Filtering is done on fields :
  • licenseKey
  • licenseType
Given I am authenticated as K0002
and there is a Base Device of category Kirk with MAC ABCDEF012345
and Port Type IPEI
that has a license with key License Key and type License Type and id 12
and another license with key Another License Key and type Another License Type and id 13
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys?_q=other
Then I should receive HTTP/1.1 200 OK and following body:
{
  "href": "/api/customers/K0002/devices/base/ABCDEF012345/license-keys?_offset=0&_pagesize=16&_q=other",
  "offset": 0,
  "size": 1,
  "total": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/devices/base/ABCDEF012345/license-keys/13",
    "links": [],
    "data": [{
      "name": "licenseKey",
      "value": "Another License Key"
    }, {
      "name": "licenseType",
      "value": "Another License Type"
    }]
  }]
}
GET returns 400 if base is not of Kirk type
Given I am authenticated as K0002
And there is a Base Device of category NotAKirk with MAC ABCDEF012345
and Port Type PORT
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Licenses are only available for Kirk bases"
  }]
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/base/ABCDEF012345/license-keys
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"
}
GET fails meaningfully if requested Base Device does not exist
Given I am authenticated as K0002
And there is no Base Device with id ABCDEF012345
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys
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 get licences of other Customer
Given I am authenticated as K0003
and there is a Base Device of category Kirk with MAC ABCDEF012345
and Port Type IPEI
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys
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 cannot access Base Licences of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/devices/base/ABCDEF012345/license-keys
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 Base Licences of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/base/ABCDEF012345/license-keys
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"
}