Api >

Service Portal REST API

GET trunk properties as Operator or Admin
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • shortenOnZero: true
  • baseNumberReachable: false
  • hairpinCallsEnabled: true
  • clipNoScreeningEnabled: true
  • site with salesForceId: a0b20000000ADEF
  • customerContract with salesForceId: a0b20000000AGHI
  • softswitch with id: 100
  • dropExtension as Group Service with ID: 200
  • And the maximum Trunk digits for Customer K0002 is set to 3
  • inboundBlacklistGlobalProfile with id 123 and name Test_Inbound_Blacklist_Global_Profile and assign it to the trunk
  • outboundBlacklistGlobalProfile with id 124 and name Test_Outbound_Blacklist_Global_Profile and assign it to the trunk
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/trunks/0048.22.123456.00-20",
  "links": [{
    "rel": "site",
    "href": "/api/customers/K0002/sites/a0b20000000ADEF"
  }, {
    "rel": "customer",
    "href": "/api/customers/K0002"
  }, {
    "rel": "customerContract",
    "href": "/api/customers/K0002/contracts/a0b20000000AGHI"
  }, {
    "rel": "softswitch",
    "href": "/api/operators/C0002/softswitches/100"
  }, {
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/group-services/100"
  }, {
    "rel": "timezone",
    "href": "INHERIT"
  }, {
    "rel": "availableExtensionNumbers",
    "href": "/api/customers/K0002/trunks/0048.22.123456.00-20/available-extensions"
  }, {
    "rel": "availableContracts",
    "href": "/api/customers/K0002/contracts"
  }, {
    "rel": "availableSoftswitches",
    "href": "/api/operators/C0002/softswitches"
  }, {
    "rel": "availableDropExtensions",
    "href": "/api/customers/K0002/trunks/0048.22.123456.00-20/available-drop-extensions"
  }, {
    "rel": "inboundBlacklistGlobalProfile",
    "href": "/api/customers/K0002/blacklist-global-profiles/Test_Inbound_Blacklist_Global_Profile"
  }, {
    "rel": "outboundBlacklistGlobalProfile",
    "href": "/api/customers/K0002/blacklist-global-profiles/Test_Outbound_Blacklist_Global_Profile"
  }],
  "data": [{
    "name": "formatDisplay",
    "value": "+48 (22) 123456(00-20)"
  }, {
    "name": "trunkNumber",
    "value": "001"
  }, {
    "name": "baseNumber",
    "value": "+48 (22) 123456"
  }, {
    "name": "inboundCallsEnabled",
    "value": true
  }, {
    "name": "outboundCallsEnabled",
    "value": true
  }, {
    "name": "numberblockStart",
    "value": 0
  }, {
    "name": "numberblockEnd",
    "value": 20
  }, {
    "name": "shortenOnZero",
    "value": true
  }, {
    "name": "baseNumberReachable",
    "value": false
  }, {
    "name": "hairpinCallsEnabled",
    "value": true
  }, {
    "name": "clipNoScreeningEnabled",
    "value": true
  }, {
    "name": "suppressLineno",
    "value": "OFF"
  }]
}
Admin can see salesForceId property
Given I am authenticated as Admin
And there is a Trunk with ID 12
which has:
  • salesForceId: a0b20000000ACCC
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.0-9
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a0b20000000ACCC"
  }]
}
GET returns null customerContract if it is not set
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • customerContract: null
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "customerContract",
    "href": null
  }]
}
GET trunk properties as Customer or System Integrator
Given I am authenticated as customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • dropExtension as Group Service with ID: 200
  • And the maximum Trunk digits for Customer K0002 is set to 2
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/trunks/0048.22.123456.00-20",
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/group-services/100"
  }, {
    "rel": "timezone",
    "href": "INHERIT"
  }, {
    "rel": "availableExtensionNumbers",
    "href": "/api/customers/K0002/trunks/0048.22.123456.00-20/available-extensions"
  }, {
    "rel": "availableDropExtensions",
    "href": "/api/customers/K0002/trunks/0048.22.123456.00-20/available-drop-extensions"
  }],
  "data": [{
    "name": "formatDisplay",
    "value": "+48 (22) 123456(00-20)"
  }, {
    "name": "trunkNumber",
    "value": "01"
  }, {
    "name": "suppressLineno",
    "value": "OFF"
  }]
}
Drop Extension link is null if no Drop Extension is set
Given I am authenticated as customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • no dropExtension assigned
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/trunks/0048.22.123456.00-20",
  "links": [{
    "rel": "dropExtension",
    "href": null
  }]
}
GET trunk without specified range
Given I am authenticated as customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456
Then I should receive HTTP/1.1 200 OK
And Content-Type header should be application/vnd.collection.next+json
with following body:
{
  "href": "/api/customers/K0002/trunks/0048.22.123456",
  "data": [{
    "name": "formatDisplay",
    "value": "+48 (22) 123456"
  }]
}
Cannot GET trunk without specified range if range is set for Trunk
Given I am authenticated as customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Trunk with number 0048.22.123456 has not been found",
  "title": "Trunk not found",
  "described_by": "http://api.nfon.net/probs/trunk-not-found"
}
Customer cannot GET other Customer's Trunk data
Given there is a Trunk with ID 12
and I am authenticated as Customer K0003
When I ask for a trunk /api/customers/K0002/trunks/0048.22.346346.0-9
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Incorrect Trunk Number
Given there is no Trunk with number +48 (22) 346346(0-9)
and I am authenticated as customer K0002
When I ask for a trunk /api/customers/K0002/trunks/0048.22.346346.09
Then I should receive HTTP/1.1 400 Bad Request
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Trunk Number 0048.22.346346.09 is incorrect",
  "title": "Incorrect Trunk Number",
  "described_by": "http://api.nfon.net/probs/incorrect-trunk-number"
}
Missing Trunk
Given there is no Trunk with number +48 (22) 346346(0-9)
and I am authenticated as customer K0002
When I ask for a trunk /api/customers/K0002/trunks/0048.22.346346.0-9
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "detail": "Trunk with number 0048.22.346346.0-9 has not been found",
  "title": "Trunk not found",
  "described_by": "http://api.nfon.net/probs/trunk-not-found"
}
Missing Customer
and I am authenticated as Admin
When I ask for a trunk /api/customers/K404/trunks/0048.22.346346.0-9
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
System Integrator cannot Trunk data of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/trunks/0048.22.346346.0-9
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 Trunk of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/trunks/0048.22.346346.0-9
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"
}