Api >

Service Portal REST API

GET retrieves Customer's DID
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan enabled
And there is a queue service with id 100 and 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:
  • Group with extension number 555 set as destination
When I send /api/customers/K0002/dids/0048.22.123456-0
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids/0048.22.123456-0",
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-1"
  }, {
    "rel": "destination",
    "href": "/api/customers/K0002/dids/0048.22.123456-0/destination"
  }, {
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/dids/available-destinations"
  }],
  "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 retrieves Customer's DID when it has LyncOption assigned
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan enabled
And there is a queue service with id 100 and 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:
  • Group with extension number 555 set as destination
and there is a Lync Option assigned to this DID
When I send /api/customers/K0002/dids/0048.22.123456-0
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids/0048.22.123456-0",
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-1"
  }, {
    "rel": "destination",
    "href": "/api/customers/K0002/dids/0048.22.123456-0/destination"
  }],
  "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 retrieves Customer's DID when destination is not set
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan enabled
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
When I send /api/customers/K0002/dids/0048.22.123456-0
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids/0048.22.123456-0",
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-1"
  }, {
    "rel": "destination",
    "href": "/api/customers/K0002/dids/0048.22.123456-0/destination"
  }, {
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/dids/available-destinations"
  }],
  "data": [{
    "name": "trunkNumber",
    "value": "+48 (22) 123456(0-1)"
  }, {
    "name": "didNumber",
    "value": "+48 (22) 123456-0"
  }, {
    "name": "didExtension",
    "value": "0"
  }]
}
GET retrieves Customer's DID when Emergency Dial Plan is disabled
Given I am authenticated as customer K0002
And Customer K0002 has Emergency Dial Plan disabled
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
When I send /api/customers/K0002/dids/0048.22.123456-0
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/dids/0048.22.123456-0",
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-1"
  }, {
    "rel": "destination",
    "href": "/api/customers/K0002/dids/0048.22.123456-0/destination"
  }, {
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/dids/available-destinations"
  }],
  "data": [{
    "name": "trunkNumber",
    "value": "+48 (22) 123456(0-1)"
  }, {
    "name": "didNumber",
    "value": "+48 (22) 123456-0"
  }, {
    "name": "didExtension",
    "value": "0"
  }]
}
Missing DID
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.345678-9
Then I should get HTTP/1.1 404 Not Found
{
  "title": "DID not found",
  "detail": "DID with number [+48 (22) 345678-9] has not been found",
  "described_by": "http://api.nfon.net/probs/did-not-found"
}
Incorrect DID number format
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/555
Then I should get HTTP/1.1 400 Bad Request
{
  "detail": "Phone Number [555] is incorrect",
  "title": "Incorrect Phone Number",
  "described_by": "http://api.nfon.net/probs/incorrect-phone-number"
}
Customer cannot GET other Customer's DID
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 DID 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 DID 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"
}