Api >

Service Portal REST API

PUT updates Routing Prefix Extension's basic data (displayName)
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Name"
  }]
}
Then I should receive HTTP/1.1 200 OK
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Name"
  }]
}
PUT updates Routing Prefix Extension's extension number and returns href with new extensionNumber
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "1717"
  }]
}
Then I should receive HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/targets/routing-prefix/1717"
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/1717 returns HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "1717"
  }]
}
PUT updates Routing Prefix Extension's links
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and blacklistProfile with id 43
  • and primary device ABCDEF012345

And there are another
  • blacklistProfile with id 77
  • and device 012345ABCDEF that is assigned to Routing Prefix Extension 17
  • and a Routing Prefix Extension with ID 555
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/77"
  }, {
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/012345ABCDEF"
  }]
}
Then I should receive HTTP/1.1 200 OK

Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/77"
  }, {
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/012345ABCDEF"
  }]
}
PUT returns 400 if trying to set primaryDevice to device that is not attached to the Routing Prefix Extension
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with extension number 17 and display name Routing Prefix Extension
and there is a standard device with Id ABCDEF012345 which is not attached to the Routing Prefix Extension
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345"
  }]
}
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": "Primary device ABCDEF012345 must be on Phone Extension devices list",
    "path": "primaryDevice",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
PUT updates Routing Prefix Extension's Geographic settings
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and language de
  • and dialPrefix 0
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "language",
    "value": "en"
  }, {
    "name": "dialPrefix",
    "value": "9"
  }]
}
Then I should receive HTTP/1.1 200 OK
Given I am authenticated as customer K0002
and useTps field is allowed by Operator Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "language",
    "value": "en"
  }, {
    "name": "dialPrefix",
    "value": "9"
  }]
}
PUT updates Routing Prefix Extension's Configuration settings
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and costCenter Cost Center
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "costCenter",
    "value": "New Cost Center"
  }]
}
Then I should receive HTTP/1.1 200 OK
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "href": "/api/customers/K0002/targets/routing-prefix/17",
  "links": [{
    "rel": "devices",
    "href": "/api/customers/K0002/targets/routing-prefix/17/devices"
  }, {
    "rel": "inboundTrunkNumbers",
    "href": "/api/customers/K0002/targets/routing-prefix/17/inbound-trunk-numbers"
  }, {
    "rel": "blacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/5"
  }, {
    "rel": "availableBlacklistProfiles",
    "href": "/api/customers/K0002/blacklist-profiles"
  }],
  "data": [{
    "name": "extensionNumber",
    "value": "17"
  }, {
    "name": "displayName",
    "value": "Routing Prefix Extension"
  }, {
    "name": "language",
    "value": "de"
  }, {
    "name": "costCenter",
    "value": "New Cost Center"
  }, {
    "name": "dialPrefix",
    "value": null
  }]
}
PUT returns 400 if dialPrefix has invalid value
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and dialPrefix 0
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "48"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Invalid value for dialPrefix '48', expected no value, 0 or 9",
    "path": "dialPrefix",
    "value": "48"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "dialPrefix",
    "value": "0"
  }]
}
PUT returns 400 if blacklistProfile is null
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Blacklist Profile cannot be null",
    "path": "blacklistProfile",
    "value": null
  }]
}
PUT returns 400 if primaryDevice is null when Routing Prefix Extension has attached devices
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and primary device ABCDEF012345
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Primary Device cannot be null if there are attached devices",
    "path": "primaryDevice",
    "value": null
  }]
}
PUT returns 403 if Customer tries to access another Customer's Routing Prefix Extension
Given I am authenticated as K0003
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
assigned to Customer K0002
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Routing Prefix Extension"
  }]
}
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"
}
PUT returns 403 if Customer tries to assign another Customer's Blacklist Profile
Given I am authenticated as K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and blacklistProfile with id 43
And there is another Blacklist Profile with id 78 that belongs to Customer K0003
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0003/blacklist-profiles/78"
  }]
}
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"
}
And authenticated call to /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/43"
  }]
}
PUT returns 403 if Admin tries to assign another Customer's Blacklist Profile
Given I am authenticated as admin
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and blacklistProfile with id 43
And there is another Blacklist Profile with id 78 that belongs to Customer K0003
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0003/blacklist-profiles/78"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body:
{
  "errors": [{
    "message": "Given Blacklist Profile with ID 78 is not available for Customer K0002",
    "path": "blacklistProfile"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "blacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/43"
  }]
}
PUT returns 403 if Customer tries to assign another Customer's Device
Given I am authenticated as K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and primary device ABCDEF012345
And there is a Device 012345ABCDEF that belongs to Customer K0003
When I send /api/customers/K0003/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0003/devices/standard/012345ABCDEF"
  }]
}
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"
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345"
  }]
}
PUT returns 400 if primary device is not one of the Routing Prefix Extension's devices
Given I am authenticated as customer K0002
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and primary device ABCDEF012345
And there is a Device 012345ABCDEF that is not assigned to Routing Prefix Extension 17
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/012345ABCDEF"
  }]
}
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": "Primary device 012345ABCDEF must be on Phone Extension devices list",
    "path": "primaryDevice",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345"
  }]
}
PUT returns 400 if Admin tries to assign another Customer's Device
Given I am authenticated as admin
and there is a Routing Prefix Extension with
  • extension number 17
  • and display name Routing Prefix Extension
  • and primary device ABCDEF012345
And there is a Device 012345ABCDEF that belongs to Customer K0003
When I send /api/customers/K0002/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0003/devices/standard/012345ABCDEF"
  }]
}
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": "Primary device 012345ABCDEF must be on Phone Extension devices list",
    "path": "primaryDevice",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/routing-prefix/17 returns HTTP/1.1 200 OK with following body:
{
  "links": [{
    "rel": "primaryDevice",
    "href": "/api/customers/K0002/devices/standard/ABCDEF012345"
  }]
}
Missing customer
Given I am authenticated as admin
When I send /api/customers/K404/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "Routing Prefix Extension"
  }]
}
Then I should get HTTP/1.1 404 Not Found
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Cannot update not existing Routing Prefix Extension
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/routing-prefix/404 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "Routing Prefix Extension"
  }]
}
Then I should get HTTP/1.1 404 Not Found
{
  "detail": "routing prefix extension with extension number 404 has not been found",
  "title": "Routing prefix extension not found",
  "described_by": "http://api.nfon.net/probs/extension-not-found"
}
System Integrator cannot update Routing Prefix Extension of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{}
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 Routing Prefix Extension of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/routing-prefix/17 as application/json; charset=UTF-8 with following body:
{}
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"
}