Api >

Service Portal REST API

PUT updates Handset Device with bluetoothPin
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has active Handset with port Port0 and BLUETOOTH_PIN option set to 6130
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as K0002
Then request /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 should return
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }, {
    "name": "suppressLineno",
    "value": "DEFAULT"
  }]
}
PUT updates Handset Device note property
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has active Handset with port Port0 and BLUETOOTH_PIN option set to 6130
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as K0002
Then request /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 should return
{
  "data": [{
    "name": "note",
    "value": "my personal note for this device"
  }]
}
PUT deletes Handset Device note property if empty value is given
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has active Handset with port Port0 and BLUETOOTH_PIN option set to 6130
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "note",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as K0002
Then request /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 should return
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT deletes Handset Device note property if null value is given
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 and it has active Handset with port Port0 and BLUETOOTH_PIN option set to 6130
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as K0002
Then request /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 should return
{
  "data": [{
    "name": "note",
    "value": null
  }]
}
PUT fails meaningfully if Handset Device does not exist
Given I am authenticated as K0002
And there is a Base Device with MAC ABCDEF012345 which does not have handset with port Port404
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port404 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with following body
{
  "title": "Device not found",
  "detail": "Device with unique identifier Port404 has not been found",
  "described_by": "http://api.nfon.net/probs/device-not-found"
}
Cannot update Handset for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/devices/base/ABCDEF012345/handsets/Port0
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"
}
Customer cannot change other Customer Handset
Given I am authenticated as Customer K0003
and there is a Base Device with MAC ABCDEF012345 and it has active Handset with port Port0
When I send /api/customers/K0002/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }]
}
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 update Handset 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/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }]
}
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 update Handset of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/devices/base/ABCDEF012345/handsets/Port0 using application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "bluetoothPin",
    "value": "7596"
  }]
}
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"
}