Api >

Service Portal REST API

GET retrieves all Customer's DIDs
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan enabled
And there is a queue service with name display name and service number 345 and extension number 555
And there is a Phone Extension with extension number 777 and display name emergency
And there is a Trunk with:
  • baseNumber +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 1
And there is a DID with extension 0 assigned to this Trunk
which has:
  • Queue with extension number 555 set as destination
  • Phone Extension with extension number 777 set as emergency extension with priority 2
And there is another Trunk with baseNumber +48 (22) 888999 and no range defined
And there is a DID with no extension, assigned to this Trunk
which has:
  • no destination set
  • no emergency extension set
When I send /api/customers/K0002/dids
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids?_offset=0&_pagesize=16&_orderBy=didNumber&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-0",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-1)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-0"
    }, {
      "name": "didExtension",
      "value": "0"
    }, {
      "name": "destinationExtensionNumber",
      "value": "555"
    }, {
      "name": "destinationServiceNumber",
      "value": "345"
    }, {
      "name": "destinationServiceCode",
      "value": "*770345"
    }, {
      "name": "destinationDisplayName",
      "value": "display name"
    }, {
      "name": "destinationType",
      "value": "QUEUE"
    }]
  }, {
    "href": "/api/customers/K0002/dids/0048.22.888999",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 888999"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 888999"
    }, {
      "name": "didExtension",
      "value": ""
    }]
  }]
}
GET retrieves filtered Customer's DIDs
Filtering is done on fields :
  • trunkNumber
  • didNumber
  • destinationExtension
  • destinationDisplayName
  • emergencyExtensionName
  • emergencyExtensionNumber
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan enabled
And there is a queue service with name display name and service number 345 and extension number 555
And there is a Phone Extension with extension number 777 and display name emergency
And there is a Trunk with:
  • baseNumber +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 1
And there is a DID with extension 0 assigned to this Trunk
which has:
  • Queue with extension number 555 set as destination
  • Phone Extension with extension number 777 set as emergency extension with priority 2
And there is another Trunk with baseNumber +48 (22) 888999 and no range defined
And there is a DID with no extension, assigned to this Trunk
which has:
  • no destination set
  • no emergency extension set
When I send /api/customers/K0002/dids?_q=123456
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids?_offset=0&_pagesize=16&_q=123456&_orderBy=didNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-0",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-1)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-0"
    }, {
      "name": "didExtension",
      "value": "0"
    }, {
      "name": "destinationExtensionNumber",
      "value": "555"
    }, {
      "name": "destinationServiceNumber",
      "value": "345"
    }, {
      "name": "destinationServiceCode",
      "value": "*770345"
    }, {
      "name": "destinationDisplayName",
      "value": "display name"
    }, {
      "name": "destinationType",
      "value": "QUEUE"
    }]
  }]
}
GET does not returns Emergency Extension properties if Emergency Dial Plan is disabled for Customer
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan disabled
And there is a queue service with name display name and service number 345 and extension number 555
And there is a Trunk with:
  • baseNumber +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 1
And there is a DID with extension 0 assigned to this Trunk
which has:
  • Queue with extension number 555 set as destination
  • no Emergency Extension set
When I send /api/customers/K0002/dids
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids?_offset=0&_pagesize=16&_orderBy=didNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-0",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-1)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-0"
    }, {
      "name": "didExtension",
      "value": "0"
    }, {
      "name": "destinationExtensionNumber",
      "value": "555"
    }, {
      "name": "destinationServiceNumber",
      "value": "345"
    }, {
      "name": "destinationServiceCode",
      "value": "*770345"
    }, {
      "name": "destinationDisplayName",
      "value": "display name"
    }, {
      "name": "destinationType",
      "value": "QUEUE"
    }]
  }]
}
GET returns asterisk destination extension number
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan disabled
And there is a queue service with name display name and service number 345 and asterisk extension number *555
And there is a Trunk with:
  • baseNumber +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 1
And there is a DID with extension 0 assigned to this Trunk
which has:
  • Queue with extension number *555 set as destination
  • no Emergency Extension set
When I send /api/customers/K0002/dids
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids?_offset=0&_pagesize=16&_orderBy=didNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [],
  "items": [{
    "href": "/api/customers/K0002/dids/0048.22.123456-0",
    "links": [],
    "data": [{
      "name": "trunkNumber",
      "value": "+48 (22) 123456(0-1)"
    }, {
      "name": "didNumber",
      "value": "+48 (22) 123456-0"
    }, {
      "name": "didExtension",
      "value": "0"
    }, {
      "name": "destinationExtensionNumber",
      "value": "*555"
    }, {
      "name": "destinationDisplayName",
      "value": "display name"
    }, {
      "name": "destinationType",
      "value": "QUEUE"
    }]
  }]
}
Customer cannot GET other Customer's DIDs
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/dids
Then I should get HTTP/1.1 403 Forbidden
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Missing customer
Given I am authenticated as admin
When I send /api/customers/K0404/dids
Then I should get HTTP/1.1 404 Not Found
{
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
System Integrator cannot access DIDs of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/dids
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 DIDs of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/dids
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"
}