Api >

Service Portal REST API

Disable external numbers for CUSTOMER
Test setup
Given there is a Phone Extension with extension number 17 and Voice Mail ID 54
and it has enabled external numbers
and there is a Phone Book with id 1000 and number +49 (66) 1234-56 and name Phone Book
and Phone Book is set as Default Call Forward
Given I am authenticated
When I send /api/customers/K0002/options/external-numbers
as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "allowed",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated
When I send /api/customers/K0002/targets/phone-extensions/17/call-forwards
Then the external numbers should be disabled on phone extension
{
  "href": "/api/customers/K0002/targets/phone-extensions/17/call-forwards",
  "data": [{
    "name": "externalNumbersEnabled",
    "value": false
  }]
}
Given I am authenticated
When I send /api/customers/K0002/targets/phone-extensions/17/call-forwards/DEFAULT
Then the external call forward should not be reset to No action
{
  "href": "/api/customers/K0002/targets/phone-extensions/17/call-forwards/DEFAULT",
  "links": [{
    "rel": "current",
    "href": "/api/customers/K0002/targets/external/004966123456"
  }, {
    "rel": "available",
    "href": "/api/customers/K0002/targets/phone-extensions/17/call-forwards/DEFAULT/available"
  }],
  "data": [{
    "name": "name",
    "value": "Phone Book"
  }, {
    "name": "type",
    "value": "PHONEBOOK"
  }, {
    "name": "extensionNumber",
    "value": "+49 (66) 1234-56"
  }]
}
Enable external numbers for CUSTOMER
Test setup
Given there is a Phone Extension with extension number 17 and Voice Mail ID 54
and it has enabled external numbers
and there is a Phone Book with id 1000 and number +49 (66) 1234-56 and name Phone Book
and Phone Book is set as Default Call Forward
Given I am authenticated
When I send /api/customers/K0002/options/external-numbers
as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "allowed",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated
When I send /api/customers/K0002/targets/phone-extensions/17/call-forwards
Then the external numbers should be enabled on phone extension
{
  "href": "/api/customers/K0002/targets/phone-extensions/17/call-forwards",
  "data": [{
    "name": "externalNumbersEnabled",
    "value": true
  }]
}
Given I am authenticated
When I send /api/customers/K0002/targets/phone-extensions/17/call-forwards/DEFAULT
Then the external call forward should not be changed
{
  "href": "/api/customers/K0002/targets/phone-extensions/17/call-forwards/DEFAULT",
  "data": [{
    "name": "name",
    "value": "Phone Book"
  }, {
    "name": "type",
    "value": "PHONEBOOK"
  }, {
    "name": "extensionNumber",
    "value": "+49 (66) 1234-56"
  }]
}
Missing Customer
Test setup
Given there is a Phone Extension with extension number 17 and Voice Mail ID 54
and it has enabled external numbers
and there is a Phone Book with id 1000 and number +49 (66) 1234-56 and name Phone Book
and Phone Book is set as Default Call Forward
Given I am authenticated as Admin
When I send /api/customers/K404/options/external-numbers
as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "allowed",
    "value": false
  }]
}
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"
}