Api >

Service Portal REST API

PUT updates trunkNumber and dropExtension
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 371 set as dropExtension
  • and the maximum Trunk digits for Customer K0002 is set to 3
  • but without Subcontract of the customer for the Trunk is inactive
And there is another Phone Extension with ID 300 and extension 159 When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/159"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Europe.Berlin"
  }],
  "data": [{
    "name": "trunkNumber",
    "value": 5
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Customer K0002
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.0-20
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/159"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Europe.Berlin"
  }],
  "data": [{
    "name": "trunkNumber",
    "value": "005"
  }]
}
Cannot update dropExtension with invalid destination
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 371 set as dropExtension
  • and the maximum Trunk digits for Customer K0002
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/BUSY"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with body
{
  "detail": "Could not create or update resource due to constraint violations",
  "title": "Validation error",
  "errors": [{
    "message": "Destination type should be one of: [CONFERENCE, EFAX, FRONTDESK, GROUP, IVR, NOOP, PHONEEXTENSION, QUEUE, ROUTINGPREFIX, SKILL, TIMECONTROL, VOICEMAIL]",
    "path": "dropExtension",
    "value": "BUSY"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Cannot update trunk due to the inactive customer subcontract
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 371 set as dropExtension
  • and the maximum Trunk digits for Customer K0002 is set to 3
  • but Subcontract of the customer for the Trunk is inactive
And there is another Phone Extension with ID 300 and extension 159 When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/phone-extensions/159"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Europe.Berlin"
  }],
  "data": [{
    "name": "trunkNumber",
    "value": 5
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with body
{
  "errors": [{
    "message": "Trunk update is not allowed due to the inactive customer subcontract.",
    "value": null
  }]
}
Can update dropExtension with NO_ACTION destination
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0002/targets/NO_ACTION"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update dropExtension with null destination
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": null
  }]
}
Then I should receive HTTP/1.1 204 No Content
Cannot update dropExtension with destination of another Customer
Given I am authenticated as ADMIN
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • Phone Extension with ID 200 and extension 371 set as dropExtension
  • and the maximum Trunk digits for Customer K0002
And there is another Phone Extension with ID 300 and extension 159 that belongs to another Customer K0003
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "dropExtension",
    "href": "/api/customers/K0003/targets/phone-extensions/159"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with body
{
  "errors": [{
    "message": "Destination must belong to Customer [K0002]",
    "path": "dropExtension",
    "value": "/api/customers/K0003/targets/phone-extensions/159"
  }]
}
Can update the inbound global blacklist profile
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
and there is a Blacklist Profile with id 123 and name Test_Blacklist_Global_Profile
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "inboundBlacklistGlobalProfile",
    "href": "/api/customers/K0002/blacklist-global-profiles/Test_Blacklist_Global_Profile"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Can update the outbound global blacklist profile
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
and there is a Blacklist Profile with id 123 and name Test_Blacklist_Global_Profile
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "outboundBlacklistGlobalProfile",
    "href": "/api/customers/K0002/blacklist-global-profiles/Test_Blacklist_Global_Profile"
  }]
}
Then I should receive HTTP/1.1 204 No Content
PUT updates Trunk's data as Operator
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • shortenOnZero: true
  • baseNumberReachable: false
  • hairpinCallsEnabled: true
  • clipNoScreeningEnabled: true
  • site with salesForceId: a0b20000000ADEF
  • customerContract with salesForceId: a0b20000000AGHI
  • softswitch with id: 100
  • And the maximum Trunk digits for Customer K0002 is set to 3
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "trunkNumber",
    "value": 2
  }, {
    "name": "clipNoScreeningEnabled",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "trunkNumber",
    "value": "002"
  }, {
    "name": "clipNoScreeningEnabled",
    "value": false
  }]
}
PUT updates Trunk's links as Operator
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • numberblockStart: 0
  • numberblockEnd: 20
  • shortenOnZero: true
  • baseNumberReachable: false
  • hairpinCallsEnabled: true
  • clipNoScreeningEnabled: true
  • site with salesForceId: a0b20000000ADEF
  • customerContract with salesForceId: a0b20000000AGHI
  • softswitch with id: 100
and there is a Customer Contract with salesForceId 800D0000003ARnKIAW
and there is a Softswitch with ID 200
that has following Trunk: When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "customerContract",
    "href": "/api/customers/K0002/contracts/800D0000003ARnKIAW"
  }, {
    "rel": "softswitch",
    "href": "/api/operators/C0002/softswitches/200"
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Operator C0002
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "customerContract",
    "href": "/api/customers/K0002/contracts/800D0000003ARnKIAW"
  }, {
    "rel": "softswitch",
    "href": "/api/operators/C0002/softswitches/200"
  }]
}
Admin can update salesForceId and hairpinCallsEnabled
Given I am authenticated as Admin
And there is a Trunk with ID 12
which has:
  • salesForceId: a0b20000000ACCC
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • hairpinCallsEnabled: true
  • softswitch with id: 100
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a0b20000000ABBB"
  }, {
    "name": "hairpinCallsEnabled",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content
Given I am authenticated as Admin
When I ask for a trunk /api/customers/K0002/trunks/0048.22.123456.00-20
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a0b20000000ABBB"
  }, {
    "name": "hairpinCallsEnabled",
    "value": false
  }]
}
Operator cannot update salesForceId and hairpinCallsEnabled
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • salesForceId: a0b20000000ACCC
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a0b20000000ABBB"
  }, {
    "name": "hairpinCallsEnabled",
    "value": false
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Invalid field.",
    "path": "salesForceId"
  }, {
    "message": "Invalid field.",
    "path": "hairpinCallsEnabled"
  }]
}
cannot update Trunk if trunkNumber is not a positive integer
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "trunkNumber",
    "value": -1
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "trunkNumber must be positive integer",
    "path": "trunkNumber",
    "value": -1
  }]
}
cannot update Trunk if trunkNumber has more digits than it is allowed for Customer
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
And for Customer K0002, maximum digits for Trunks is set to 2
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "trunkNumber",
    "value": 333
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Only numbers with 2 digit(s) are allowed for trunkNumber",
    "path": "trunkNumber",
    "value": 333
  }]
}
Cannot update Trunk if trunkNumber is not unique
Given I am authenticated as Operator C0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
And there is another Trunk with ID 24
which has:
  • trunkNumber: 2
  • baseNumber: +48 (22) 123555
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "trunkNumber",
    "value": 2
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "trunkNumber 2 is already used",
    "path": "trunkNumber",
    "value": 2
  }]
}
Admin cannot update Trunk if salesForceId is not unique
Given I am authenticated as Admin
And there is a Trunk with ID 12
which has:
  • salesForceId: a0b20000000ABBB
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
And there is another Trunk with ID 24
which has:
  • salesForceId: a0b20000000ACCC
  • baseNumber: +48 (22) 123555
  • numberblockStart: 0
  • numberblockEnd: 20
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "salesForceId",
    "value": "a0b20000000ACCC"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "salesForceId [a0b20000000ACCC] is already used by another Trunk",
    "path": "salesForceId",
    "value": "a0b20000000ACCC"
  }]
}
Admin cannot update Trunk with Customer Contract that belongs to different Customer
Given I am authenticated as Admin
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
and there is a Customer Contract with salesForceId 800D0000003ARnKIAW for Customer K0003
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "customerContract",
    "href": "/api/customers/K0003/contracts/800D0000003ARnKIAW"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Customer Contract [800D0000003ARnKIAW] does not belong to Customer [K0002]",
    "path": "customerContract",
    "value": "/api/customers/K0003/contracts/800D0000003ARnKIAW"
  }]
}
Admin cannot update Trunk with Softswitch that belongs to different Operator
Given I am authenticated as Admin
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • softswitch with id: 100
and there is a Softswitch with ID 200 for Operator C0003
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "links": [{
    "rel": "softswitch",
    "href": "/api/operators/C0003/softswitches/200"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with following body
{
  "errors": [{
    "message": "Softswitch [200] does not belong to Operator [C0002]",
    "path": "softswitch",
    "value": "/api/operators/C0003/softswitches/200"
  }]
}
Customer and System Integrator are not allowed to update properties other than trunkNumber and dropExtension
Given I am authenticated as Customer K0002
And there is a Trunk with ID 12
which has:
  • trunkNumber: 1
  • baseNumber: +48 (22) 123456
  • numberblockStart: 0
  • numberblockEnd: 20
  • inboundCallsEnabled: true
  • outboundCallsEnabled: true
  • shortenOnZero: true
  • baseNumberReachable: false
  • hairpinCallsEnabled: true
  • clipNoScreeningEnabled: true
  • site with salesForceId: a0b20000000ADEF
  • customerContract with salesForceId: a0b20000000AGHI
  • softswitch with id: 100
  • And the maximum Trunk digits for Customer K0002 is set to 3
  • hairpinCallsEnabled: true
and there is a Customer Contract with salesForceId 800D0000003ARnKIAW
and there is a Softswitch with ID 200
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{
  "data": [{
    "name": "hairpinCallsEnabled",
    "value": false
  }, {
    "name": "salesForceId",
    "value": "a0b20000000ABBB"
  }, {
    "name": "clipNoScreeningEnabled",
    "value": false
  }],
  "links": [{
    "rel": "customerContract",
    "href": "/api/customers/K0002/contracts/800D0000003ARnKIAW"
  }, {
    "rel": "softswitch",
    "href": "/api/operators/C0002/softswitches/200"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
{
  "errors": [{
    "message": "Invalid field.",
    "path": "clipNoScreeningEnabled"
  }, {
    "message": "Invalid field.",
    "path": "hairpinCallsEnabled"
  }, {
    "message": "Invalid field.",
    "path": "salesForceId"
  }, {
    "message": "Invalid field.",
    "path": "customerContract"
  }, {
    "message": "Invalid field.",
    "path": "softswitch"
  }]
}
Missing Trunk
Given there is no Trunk with number +48 (22) 123456(0-20)
and I am authenticated as Admin
When I send /api/customers/K0002/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{}
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Trunk not found",
  "detail": "Trunk with number 0048.22.123456.0-20 has not been found",
  "described_by": "http://api.nfon.net/probs/trunk-not-found"
}
Missing Customer
and I am authenticated as Admin
When I send /api/customers/K0404/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{}
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 K0404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Customer cannot update Trunk of another Customer
Given I am authenticated as Customer K0002
When I send /api/customers/K0003/trunks/0048.22.123456.0-20
with application/json; charset=UTF-8
and body:
{}
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"
}
System Integrator cannot update Trunk 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-20
with application/json; charset=UTF-8
and body:
{}
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 update Trunk 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-20
with application/json; charset=UTF-8
and body:
{}
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"
}