Api >

Service Portal REST API

Trunk's available extension numbers
Given there is a Trunk with number +48 (22) 123456
and there is a Phone Extension with extension number 201 and display name somePhoneExtension
and there is an inbound trunk number with extension 734 and it is attached to Phone with extension number 201
and there is an inbound trunk number with extension 736
and I am authenticated as customer K0002
When I ask for a available extensions of a trunk /api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions
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.0-9/available-extensions?_offset=0&_pagesize=16",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-734",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-9)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-734"
    }, {
      "name": "didExtension",
      "value": "734"
    }, {
      "name": "destinationExtensionNumber",
      "value": "201"
    }, {
      "name": "destinationDisplayName",
      "value": "somePhoneExtension"
    }, {
      "name": "destinationType",
      "value": "PHONEEXTENSION"
    }]
  }, {
    "href": "/api/customers/K0002/dids/0048.22.123456-736",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-9)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-736"
    }, {
      "name": "didExtension",
      "value": "736"
    }]
  }]
}
Trunk's filtered available extension numbers
Filtering is done on fields :
  • destinationDisplayName
  • extensionNumber
Given there is a Trunk with number +48 (22) 123456
and there is a Phone Extension with extension number 201 and display name somePhoneExtension
and there is an inbound trunk number with extension 734 and it is attached to Phone with extension number 201
and there is an inbound trunk number with extension 736
and I am authenticated as customer K0002
When I ask for a available extensions of a trunk /api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_q=734
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=0&_pagesize=16&_q=734",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-734",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-9)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-734"
    }, {
      "name": "didExtension",
      "value": "734"
    }, {
      "name": "destinationExtensionNumber",
      "value": "201"
    }, {
      "name": "destinationDisplayName",
      "value": "somePhoneExtension"
    }, {
      "name": "destinationType",
      "value": "PHONEEXTENSION"
    }]
  }]
}
Trunk's available extension numbers are paginated
Given there is a Trunk with number +48 (22) 123456
and there is an inbound trunk number with extension 734
and there is an inbound trunk number with extension 736
and there is an inbound trunk number with extension 745
and there is an inbound trunk number with extension 752
and I am authenticated as customer K0002
When I ask for a available extensions of a trunk /api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=2&_pagesize=1
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.0-9/available-extensions?_offset=2&_pagesize=1",
  "offset": 2,
  "total": 4,
  "size": 1,
  "links": [{
    "rel": "first",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=0&_pagesize=1"
  }, {
    "rel": "next",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=3&_pagesize=1"
  }, {
    "rel": "prev",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=1&_pagesize=1"
  }, {
    "rel": "last",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions?_offset=3&_pagesize=1"
  }],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-745",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-9)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-745"
    }, {
      "name": "didExtension",
      "value": "745"
    }]
  }]
}
Cannot get Available Extensions for missing Trunk
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/trunks/0048.22.123456.0-9/available-extensions
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Trunk with number 0048.22.123456.0-9 has not been found",
  "title": "Trunk not found",
  "described_by": "http://api.nfon.net/probs/trunk-not-found"
}
Cannot get Available Extensions for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/trunks/0048.22.123456.0-9/available-extensions
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"
}
System Integrator cannot access Available Extensions 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.123456.0-9/available-extensions
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 Available Extensions of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/trunks/0048.22.123456.0-9/available-extensions
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"
}