Api >

Service Portal REST API

GET list of Trunks as Operator
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • softswitch with id: 100 and name: BTNGN1
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • inboundCallsEnabled: true
  • outboundCallsEnabled: false
  • numberblockStart: 0
  • numberblockEnd: 30
  • softswitch with id: 200 and name: BTNGN2
  • no dropExtension assigned
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks
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?_offset=0&_pagesize=16&_orderBy=trunkNumber&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": true
    }, {
      "name": "softswitchName",
      "value": "BTNGN1"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }, {
    "href": "/api/customers/K0002/trunks/0048.22.567891.0-30",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 567891(00-30)"
    }, {
      "name": "trunkNumber",
      "value": "1"
    }, {
      "name": "dropExtensionName",
      "value": null
    }, {
      "name": "dropExtension",
      "value": null
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": false
    }, {
      "name": "softswitchName",
      "value": "BTNGN2"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }]
}
GET list of filtered Trunks as Operator
Filtering is done on fields :
  • baseNumber
  • trunkNumber
  • dropExtensionName
  • dropExtension
  • softswitchName
  • siteName
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • softswitch with id: 100 and name: BTNGN1
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • inboundCallsEnabled: true
  • outboundCallsEnabled: false
  • numberblockStart: 0
  • numberblockEnd: 30
  • softswitch with id: 200 and name: BTNGN2
  • Phone Extension with ID 300 and extension 371 and name Another Phone Extension set as dropExtension
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks?_q=BTNGN1
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?_offset=0&_pagesize=16&_q=BTNGN1&_orderBy=trunkNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": true
    }, {
      "name": "softswitchName",
      "value": "BTNGN1"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }]
}
GET list of Trunks as Customer or System Integrator
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • numberblockStart: 0
  • numberblockEnd: 30
  • Phone Extension with ID 300 and extension 371 and name Another Phone Extension set as dropExtension
and I am authenticated as customer K0002
When I ask for a trunk /api/customers/K0002/trunks
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?_offset=0&_pagesize=16&_orderBy=trunkNumber&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": false
    }]
  }, {
    "href": "/api/customers/K0002/trunks/0048.22.567891.0-30",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 567891(00-30)"
    }, {
      "name": "trunkNumber",
      "value": "1"
    }, {
      "name": "dropExtensionName",
      "value": "Another Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "371"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": false
    }]
  }]
}
GET filtered list of Trunks as Customer or System Integrator
Filtering is done on fields :
  • baseNumber
  • trunkNumber
  • dropExtensionName
  • dropExtension
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • numberblockStart: 0
  • numberblockEnd: 30
  • Phone Extension with ID 300 and extension 371 and name Another Phone Extension set as dropExtension
and I am authenticated as customer K0002
When I ask for a trunk /api/customers/K0002/trunks?_q=A+Phone
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?_offset=0&_pagesize=16&_q=A+Phone&_orderBy=trunkNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": false
    }]
  }]
}
GET list of Trunks with inboundCallsEnabled=true
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • softswitch with id: 100 and name: BTNGN1
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • inboundCallsEnabled: true
  • outboundCallsEnabled: false
  • numberblockStart: 0
  • numberblockEnd: 30
  • softswitch with id: 200 and name: BTNGN2
  • no dropExtension assigned
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks?inboundCallsEnabled=true
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?_offset=0&_pagesize=16&_orderBy=trunkNumber&_order=ASC&inboundCallsEnabled=true",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": true
    }, {
      "name": "softswitchName",
      "value": "BTNGN1"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }, {
    "href": "/api/customers/K0002/trunks/0048.22.567891.0-30",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 567891(00-30)"
    }, {
      "name": "trunkNumber",
      "value": "1"
    }, {
      "name": "dropExtensionName",
      "value": null
    }, {
      "name": "dropExtension",
      "value": null
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": false
    }, {
      "name": "softswitchName",
      "value": "BTNGN2"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }]
}
GET list of Trunks with outboundCallsEnabled=true
Given there is a Trunk with ID 12
which has:
  • trunkNumber: 0
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • softswitch with id: 100 and name: BTNGN1
  • Phone Extension with ID 200 and extension 192 and name A Phone Extension set as dropExtension
And there is a Trunk with ID 15
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 567891
  • inboundCallsEnabled: true
  • outboundCallsEnabled: false
  • numberblockStart: 0
  • numberblockEnd: 30
  • softswitch with id: 200 and name: BTNGN2
  • no dropExtension assigned
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks?outboundCallsEnabled=true
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?_offset=0&_pagesize=16&_orderBy=trunkNumber&_order=ASC&outboundCallsEnabled=true",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-20",
    "links": [],
    "data": [{
      "name": "baseNumber",
      "value": "+48 (22) 123456(00-20)"
    }, {
      "name": "trunkNumber",
      "value": "0"
    }, {
      "name": "dropExtensionName",
      "value": "A Phone Extension"
    }, {
      "name": "dropExtension",
      "value": "192"
    }, {
      "name": "inboundCallsEnabled",
      "value": true
    }, {
      "name": "outboundCallsEnabled",
      "value": true
    }, {
      "name": "softswitchName",
      "value": "BTNGN1"
    }, {
      "name": "siteName",
      "value": "Dummy site K0002"
    }]
  }]
}
Missing Customer
and I am authenticated as Admin
When I ask for a trunk /api/customers/K404/trunks
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"
}
Customer cannot GET other Customer's Trunks data
Given I am authenticated as customer K0003
When I ask for a trunk /api/customers/K0002/trunks
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"
}
System Integrator cannot access Trunks of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/trunks
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 Trunks of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/trunks
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"
}