Api >

Service Portal REST API

PUT sets DID's destination link
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/queue-services/345"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
Then I should receive HTTP/1.1 200 OK
with body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/queue-services/345"
  }]
}

Given I am authenticated as customer K0002
And previous POST assigned DID to Queue with service number 345 as Inbound Trunk Number
When I send /api/customers/K0002/targets/queue-services/345/inbound-trunk-numbers/0048.22.123456-0
Then I should receive HTTP/1.1 200 OK
with body:
{
  "href": "/api/customers/K0002/targets/queue-services/345/inbound-trunk-numbers/0048.22.123456-0",
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.123456.0-1"
  }],
  "data": [{
    "name": "didExtension",
    "value": "0"
  }]
}
Cannot set null destination
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "destination is required",
    "path": "destination",
    "value": null
  }]
}
Set NO_ACTION destination when creating a new Did destination
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Update did destination to NO_ACTION when another destination already set
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Cannot set not allowed destination type
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Destination [BUSY] is not allowed",
    "path": "destination",
    "value": "/api/customers/K0002/targets/BUSY"
  }]
}
Cannot set destination if DID has Lync Option assigned
Test setup
Given 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:
  • no destination set
Given I am authenticated as customer K0002
And there is a Phone Extension with extension number 777 and display name emergency
and there is a Lync Option assigned to DID with extension 0
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0002/targets/phone-extensions/777"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "detail": "Cannot modify destination of DID that has Lync Option attached",
  "described_by": "http://api.nfon.net/probs/did-has-lync-option"
}
Cannot set destination that belongs to another Customer
Test setup
Given 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:
  • no destination set
Given I am authenticated as Admin
Given there is a queue service with id 200 for Customer K0003
When I send /api/customers/K0002/dids/0048.22.123456-0/destination
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "destination",
    "href": "/api/customers/K0003/targets/queue-services/345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Destination with ID 200 does not belong to Customer K0002",
    "path": "destination",
    "value": "/api/customers/K0003/targets/queue-services/345"
  }]
}