Api >

Service Portal REST API

POST creates a Conference Service with conference options
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }, {
    "name": "language",
    "value": "fr"
  }, {
    "name": "musicIfSingleUser",
    "value": true
  }]
}
Then I should receive HTTP/1.1 201 Created with header http://localhost:9998/api/customers/K0002/targets/conference-services/0 and body
{
  "href": "/api/customers/K0002/targets/conference-services/0"
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }, {
    "name": "language",
    "value": "fr"
  }, {
    "name": "musicIfSingleUser",
    "value": true
  }]
}
POST creates a Conference Service with user options
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "userPIN",
    "value": "7373"
  }, {
    "name": "userSignalJoinLeave",
    "value": true
  }, {
    "name": "userAnnounceJoinsLeaves",
    "value": true
  }, {
    "name": "userAnnounceUserCount",
    "value": false
  }, {
    "name": "permanentlyMute",
    "value": true
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
then request /api/customers/K0002/targets/conference-services/0 should return
{
  "data": [{
    "name": "userPIN",
    "value": "7373"
  }, {
    "name": "userSignalJoinLeave",
    "value": true
  }, {
    "name": "userAnnounceJoinsLeaves",
    "value": true
  }, {
    "name": "userAnnounceUserCount",
    "value": false
  }, {
    "name": "permanentlyMute",
    "value": true
  }]
}
POST creates a Conference Service with admin options
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "adminPIN",
    "value": "1212"
  }, {
    "name": "adminSignalJoinLeave",
    "value": true
  }, {
    "name": "adminAnnounceJoinsLeaves",
    "value": true
  }, {
    "name": "adminAnnounceUserCount",
    "value": true
  }, {
    "name": "closeAtExit",
    "value": false
  }, {
    "name": "lockUntilEntry",
    "value": false
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return
{
  "data": [{
    "name": "adminPIN",
    "value": "1212"
  }, {
    "name": "adminSignalJoinLeave",
    "value": true
  }, {
    "name": "adminAnnounceJoinsLeaves",
    "value": true
  }, {
    "name": "adminAnnounceUserCount",
    "value": true
  }, {
    "name": "closeAtExit",
    "value": false
  }, {
    "name": "lockUntilEntry",
    "value": false
  }]
}
POST creates a Conference Service with correct default values
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return
{
  "data": [{
    "name": "language",
    "value": "de"
  }, {
    "name": "musicIfSingleUser",
    "value": false
  }, {
    "name": "userSignalJoinLeave",
    "value": true
  }, {
    "name": "userAnnounceJoinsLeaves",
    "value": false
  }, {
    "name": "userAnnounceUserCount",
    "value": false
  }, {
    "name": "permanentlyMute",
    "value": false
  }, {
    "name": "adminSignalJoinLeave",
    "value": true
  }, {
    "name": "adminAnnounceJoinsLeaves",
    "value": false
  }, {
    "name": "adminAnnounceUserCount",
    "value": false
  }, {
    "name": "closeAtExit",
    "value": false
  }, {
    "name": "lockUntilEntry",
    "value": true
  }]
}
POST creates a Conference Service with random PINs if not provided
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }]
}
Then I should receive HTTP/1.1 201 Created
And Conference Service with service number 0 has:
  • AdminPIN not empty
  • UserPIN not empty
POST does not create Conference Service if adminPIN is incorrect
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "adminPIN",
    "value": "incorrect value"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Invalid PIN number format. PIN must be between 4 and 6 digits long",
    "path": "adminPIN",
    "value": "incorrect value"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create Conference Service if userPIN is incorrect
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "userPIN",
    "value": "incorrect value"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Invalid PIN number format. PIN must be between 4 and 6 digits long",
    "path": "userPIN",
    "value": "incorrect value"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service if userPIN is equal to adminPIN
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "adminPIN",
    "value": "3737"
  }, {
    "name": "userPIN",
    "value": "3737"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Admin PIN and User PIN must not be the same"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service without a displayName
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "adminPIN",
    "value": "3737"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Display name is missing",
    "path": "displayName"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service if display name contains invalid characters
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "invalid display=name"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Display name should not contain these characters: & $ ! ? = | \" { }",
    "path": "displayName",
    "value": "invalid display=name"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create Conference Service with too long display name
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Display name should have a length between 1 and 50 characters",
    "path": "displayName",
    "value": "this is a way, way, way, way, way, way, way, way, way to long displayName"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service with invalid format of extension number
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "0123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Invalid extension number format. Must not start with the dial-out-prefix (default 0)",
    "path": "extensionNumber",
    "value": "0123"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service with too long extension number
Given I am authenticated as customer K0002

When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "12345678901234567890123456789"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Extension number length should not exceed 20 characters",
    "path": "extensionNumber",
    "value": "12345678901234567890123456789"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service with duplicated extension number
Given I am authenticated as customer K0002
and there is already an extension with extension number 12345 When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "12345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "message": "Extension number is not unique.",
    "path": "extensionNumber",
    "value": "12345"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST does not create a Conference Service with invalid language code
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "language",
    "value": "xyz"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request with following body:
{
  "errors": [{
    "path": "language",
    "value": "xyz"
  }]
}
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 404 Not Found With following body:
{
  "title": "Conference Service not found",
  "detail": "Conference Service with Id 0 not found",
  "described_by": "http://api.nfon.net/probs/conference-service-not-found"
}
POST creates a Conference Service when userSignalJoinLeave is false regardless of provided userAnnounceJoinsLeaves value. userAnnounceJoinsLeaves should be set to false
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "userSignalJoinLeave",
    "value": false
  }, {
    "name": "userAnnounceJoinsLeaves",
    "value": true
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 200 OK With following body:
{
  "data": [{
    "name": "userSignalJoinLeave",
    "value": false
  }, {
    "name": "userAnnounceJoinsLeaves",
    "value": false
  }]
}
POST creates a Conference Service when adminSignalJoinLeave is false regardless of provided adminAnnounceJoinsLeaves value. adminAnnounceJoinsLeaves should be set to false
Given I am authenticated as customer K0002
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "adminSignalJoinLeave",
    "value": false
  }, {
    "name": "adminAnnounceJoinsLeaves",
    "value": true
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as customer K0002
Then request /api/customers/K0002/targets/conference-services/0 should return HTTP/1.1 200 OK With following body:
{
  "data": [{
    "name": "adminSignalJoinLeave",
    "value": false
  }, {
    "name": "adminAnnounceJoinsLeaves",
    "value": false
  }]
}
Missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }]
}
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"
}
GET returns 403 if Customer is trying to create Conference Service for other Customer
Given I am authenticated as K0003
When I send /api/customers/K0002/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden with following body:
{
  "title": "Access forbidden",
  "detail": "Access denied to [Customer] with id [K0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot create Conference Service for Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }]
}
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 create Conference Service for Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/conference-services as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Conference Service"
  }, {
    "name": "extensionNumber",
    "value": "72"
  }]
}
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"
}