Api >

Service Portal REST API

GET returns requested License Key
Given I am authenticated as K0002
and there is a Base Device of category Kirk with MAC ABCDEF012345
that has a license with key License Key and type License Type and id 12 and Port Type IPEI
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys/12
Then I should receive HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "licenseKey",
    "value": "License Key"
  }, {
    "name": "licenseType",
    "value": "License Type"
  }]
}
GET returns 404 if no License has been found
Given I am authenticated as K0002
and there is a Base Device of category Kirk with MAC ABCDEF012345
that does not have a license with if 404 and Port Type IPEI
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys/404
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "title": "License not found",
  "detail": "Device [ABCDEF012345] does not have a license with id [404]",
  "described_by": "http://api.nfon.net/probs/license-not-found"
}
Cannot read data for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/base/ABCDEF012345/license-keys/12
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/12
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 licence of other Customer
Given I am authenticated as K0003
and there is a Base Device of category Kirk with MAC ABCDEF012345
that has a license with key License Key and type License Type and id 12 and Port Type IPEI
When I send /api/customers/K0002/devices/base/ABCDEF012345/license-keys/12
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 Licence 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/12
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 Licence 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/12
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"
}