Api >

Service Portal REST API

Admin should be able to update Operator's data
Given I am authenticated as Admin
And there is Operator C0002 with
  • name: Operator Name
  • contactName: Operator Contact
  • contactEmail: operator@example.com
  • contactPhone: +49 (22) 234-456
  • notes: Some notes
  • billingAccumulated: true
  • offlineBilling: true
  • generateCdrs: true
  • ldapVisible: true
  • enableTps: true
  • defaultSystemIntegrator: S0002
  • defaultBlacklistProfile with ID 100
  • defaultPbxGroup: asterisk-1.8
  • domainName: nfon.net
  • snomLoginName: nfon
  • snomLoginPassword: snomPassword
  • aastraLoginName: example@nfon.net
  • aastraLoginPassword: aastraPassword
  • nmeeting: UNITS
  • nmeetingCustomerDefault: UNITS
  • nmeetingAfdDefault: true
  • minimumPasswordLength: 4
  • maximumPasswordLength: 8
  • voiceTrafficEncryption: true
  • rdsHost: nfon.net
  • language: en
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "name",
    "value": "new operator name"
  }, {
    "name": "contactName",
    "value": "new contact name"
  }, {
    "name": "contactEmail",
    "value": "newemail@nfon.net"
  }, {
    "name": "contactPhone",
    "value": "+48 (12) 555-666"
  }, {
    "name": "notes",
    "value": "new notes"
  }, {
    "name": "billingAccumulated",
    "value": true
  }, {
    "name": "offlineBilling",
    "value": true
  }, {
    "name": "generateCdrs",
    "value": true
  }, {
    "name": "ldapVisible",
    "value": true
  }, {
    "name": "enableTps",
    "value": true
  }, {
    "name": "domainName",
    "value": "new.nfon.net"
  }, {
    "name": "snomLoginName",
    "value": "new snom login"
  }, {
    "name": "aastraLoginName",
    "value": "newaastralogin@nfon.net"
  }, {
    "name": "snomLoginPassword",
    "value": "newSnomPassword"
  }, {
    "name": "aastraLoginPassword",
    "value": "newAastraPassword"
  }, {
    "name": "nmeeting",
    "value": "FLATRATE_UNITS"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "FLATRATE"
  }, {
    "name": "nmeetingAfdDefault",
    "value": true
  }, {
    "name": "minimumPasswordLength",
    "value": 4
  }, {
    "name": "maximumPasswordLength",
    "value": 32
  }, {
    "name": "voiceTrafficEncryption",
    "value": true
  }, {
    "name": "rdsHost",
    "value": "new.nfon.net"
  }, {
    "name": "language",
    "value": "de"
  }, {
    "name": "nqmEnabled",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "name",
    "value": "new operator name"
  }, {
    "name": "contactName",
    "value": "new contact name"
  }, {
    "name": "contactEmail",
    "value": "newemail@nfon.net"
  }, {
    "name": "contactPhone",
    "value": "+48 (12) 555-666"
  }, {
    "name": "notes",
    "value": "new notes"
  }, {
    "name": "billingAccumulated",
    "value": true
  }, {
    "name": "offlineBilling",
    "value": true
  }, {
    "name": "generateCdrs",
    "value": true
  }, {
    "name": "ldapVisible",
    "value": true
  }, {
    "name": "enableTps",
    "value": true
  }, {
    "name": "domainName",
    "value": "new.nfon.net"
  }, {
    "name": "snomLoginName",
    "value": "new snom login"
  }, {
    "name": "aastraLoginName",
    "value": "newaastralogin@nfon.net"
  }, {
    "name": "nmeeting",
    "value": "FLATRATE_UNITS"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "FLATRATE"
  }, {
    "name": "nmeetingAfdDefault",
    "value": true
  }, {
    "name": "minimumPasswordLength",
    "value": 4
  }, {
    "name": "maximumPasswordLength",
    "value": 32
  }, {
    "name": "voiceTrafficEncryption",
    "value": true
  }, {
    "name": "rdsHost",
    "value": "new.nfon.net"
  }, {
    "name": "language",
    "value": "de"
  }, {
    "name": "nqmEnabled",
    "value": true
  }]
}

And snomLoginPassword equals newSnomPassword
And aastraLoginPassword equals newAastraPassword
Admin should be able to update Operator's links
Given I am authenticated as Admin
And there is Operator C0002 with
  • defaultSystemIntegrator: S0002
  • defaultBlacklistProfile with ID 100
  • defaultPbxGroup: asterisk-1.8
  • defaultRatingProfile: 8
And there are
  • System Integrator with external identifier S0005
  • Blacklist Profile with ID 200
  • Pbx Group with name asterisk-2.0
  • Rating Profile: 23
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultSystemIntegrator",
    "href": "/api/system-integrators/S0005"
  }, {
    "rel": "defaultBlacklistProfile",
    "href": "/api/operators/C0002/blacklist-profiles/200"
  }, {
    "rel": "defaultPbxGroup",
    "href": "/api/operators/C0002/pbx-groups/asterisk-2.0"
  }, {
    "rel": "defaultRatingProfile",
    "href": "/api/operators/C0002/rating-profiles/23"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Europe.Berlin"
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "links": [{
    "rel": "defaultSystemIntegrator",
    "href": "/api/system-integrators/S0005"
  }, {
    "rel": "defaultBlacklistProfile",
    "href": "/api/operators/C0002/blacklist-profiles/200"
  }, {
    "rel": "defaultPbxGroup",
    "href": "/api/operators/C0002/pbx-groups/asterisk-2.0"
  }, {
    "rel": "defaultRatingProfile",
    "href": "/api/operators/C0002/rating-profiles/23"
  }, {
    "rel": "timezone",
    "href": "/api/time-zones/Europe.Berlin"
  }]
}
Cannot update Operator with missing required fields
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "name",
    "value": ""
  }, {
    "name": "contactName",
    "value": null
  }, {
    "name": "contactEmail",
    "value": ""
  }, {
    "name": "contactPhone",
    "value": null
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Field is required",
    "path": "name"
  }, {
    "message": "Field is required",
    "path": "contactName"
  }, {
    "message": "Email is required",
    "path": "contactEmail"
  }, {
    "message": "Field is required",
    "path": "contactPhone"
  }]
}
Cannot update Operator with invalid contact email
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "contactEmail",
    "value": "invalid email"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Email is invalid",
    "path": "contactEmail",
    "value": "invalid email"
  }]
}
Cannot update Operator with invalid phone number
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "contactPhone",
    "value": "invalid phone"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Phone Number is invalid",
    "path": "contactPhone",
    "value": "invalid phone"
  }]
}
Cannot update Operator with default System Integrator, that does not belong to him
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultSystemIntegrator",
    "href": "/api/system-integrators/S0003"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "System Integrator [S0003] does not belong to Operator [C0002]",
    "path": "defaultSystemIntegrator"
  }]
}
Cannot update Operator with default Blacklist Profile, that is specific to Customer
Given I am authenticated as Admin
And there is a Blacklist Profile with ID 200 that belongs to Customer K0002
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultBlacklistProfile",
    "href": "/api/customers/K0002/blacklist-profiles/200"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "detail": "Resource at /api/customers/K0002/blacklist-profiles/200 is of incorrect type",
  "title": "Invalid resource type",
  "described_by": "http://api.nfon.net/probs/invalid-resource-type"
}
Cannot update Operator with default Blacklist Profile, that belongs to different Operator
Given I am authenticated as Admin
And there is a Blacklist Profile with ID 200 that belongs to Operator C0003
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultBlacklistProfile",
    "href": "/api/operators/C0003/blacklist-profiles/200"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Blacklist Profile [200] does not belong to Operator [C0002]",
    "path": "defaultBlacklistProfile"
  }]
}
Cannot update Operator with default Rating Profile, that belongs to different Operator
Given I am authenticated as Admin
And there is a Rating Profile with name 8 that belongs to Operator C0003
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultRatingProfile",
    "href": "/api/operators/C0003/rating-profiles/8"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Rating Profile [8] does not belong to Operator [C0002]",
    "path": "defaultRatingProfile"
  }]
}
Cannot update Operator with default Pbx Group, that belongs to different Operator
Given I am authenticated as Admin
And there is a Blacklist Profile with ID pbx_name that belongs to Operator C0003
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "links": [{
    "rel": "defaultPbxGroup",
    "href": "/api/operators/C0003/pbx-groups/pbx_name"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Pbx Group [pbx_name] does not belong to Operator [C0002]",
    "path": "defaultPbxGroup"
  }]
}
Cannot update Operator with invalid nmeetings values
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeeting",
    "value": "INVALID_UNITS"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "FLATRATE_UNITS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Unknown enum value. Allowed values: [DEACTIVATED, UNITS, FLATRATE, FLATRATE_UNITS]",
    "path": "nmeeting",
    "value": "INVALID_UNITS"
  }, {
    "message": "Unknown enum value. Allowed values: [DEACTIVATED, UNITS, FLATRATE]",
    "path": "nmeetingCustomerDefault",
    "value": "FLATRATE_UNITS"
  }]
}
Cannot update Operator with invalid password lengths
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "minimumPasswordLength",
    "value": 3
  }, {
    "name": "maximumPasswordLength",
    "value": 33
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Password length must be between 4 and 32",
    "path": "minimumPasswordLength",
    "value": 3
  }, {
    "message": "Password length must be between 4 and 32",
    "path": "maximumPasswordLength",
    "value": 33
  }]
}
Cannot update Operator with invalid password length order
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "minimumPasswordLength",
    "value": 10
  }, {
    "name": "maximumPasswordLength",
    "value": 10
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Password minimum length must be less than maximum length",
    "path": "minimumPasswordLength",
    "value": 10
  }, {
    "message": "Password maximum length must be greater than minimum length",
    "path": "maximumPasswordLength",
    "value": 10
  }]
}
Cannot update Operator with conflicting nmeeting and nmeetingCustomerDefault values
Given I am authenticated as Admin
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeeting",
    "value": "FLATRATE"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "UNITS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Invalid nmeetingCustomerDefault. FLATRATE nmeeting allows only [DEACTIVATED, FLATRATE] nmeetingCustomerDefault values",
    "path": "nmeetingCustomerDefault",
    "value": "UNITS"
  }]
}
Cannot update Operator when not changing default, incorrect nmeetingCustomerDefault value when changing nmeeting
Given I am authenticated as Admin
And there is Operator C0002 with
  • nmeeting: FLATRATE_UNITS
  • nmeetingCustomerDefault: FLATRATE
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeeting",
    "value": "UNITS"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Invalid nmeetingCustomerDefault. UNITS nmeeting allows only [DEACTIVATED, UNITS] nmeetingCustomerDefault values",
    "path": "nmeetingCustomerDefault",
    "value": "FLATRATE"
  }]
}
Cannot update Operator when not deactivating nmeeting defaults when deactivating nmeeting
Given I am authenticated as Admin
And there is Operator C0002 with
  • nmeeting: FLATRATE_UNITS
  • nmeetingCustomerDefault: FLATRATE
  • nmeetingAfdDefault: true
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeeting",
    "value": "DEACTIVATED"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Invalid nmeetingCustomerDefault. DEACTIVATED nmeeting allows only [DEACTIVATED] nmeetingCustomerDefault values",
    "path": "nmeetingCustomerDefault",
    "value": "FLATRATE"
  }, {
    "message": "Invalid nmeetingAfdDefault, should be disabled if nmeeting or nmeetingCustomerDefault are DEACTIVATED",
    "path": "nmeetingAfdDefault",
    "value": true
  }]
}
Cannot update Operator when not disabling nmeetingAfdDefault if deactivating nmeetingCustomerDefault
Given I am authenticated as Admin
And there is Operator C0002 with
  • nmeeting: FLATRATE_UNITS
  • nmeetingCustomerDefault: FLATRATE
  • nmeetingAfdDefault: true
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeetingCustomerDefault",
    "value": "DEACTIVATED"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Invalid nmeetingAfdDefault, should be disabled if nmeeting or nmeetingCustomerDefault are DEACTIVATED",
    "path": "nmeetingAfdDefault",
    "value": true
  }]
}
Cannot update Operator when enabling nmeetingAfdDefault with DEACTIVATED nmeeting
Given I am authenticated as Admin
And there is Operator C0002 with
  • nmeeting: DEACTIVATED
  • nmeetingCustomerDefault: DEACTIVATED
  • nmeetingAfdDefault: false
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeetingAfdDefault",
    "value": true
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
with body:
{
  "errors": [{
    "message": "Invalid nmeetingAfdDefault, should be disabled if nmeeting or nmeetingCustomerDefault are DEACTIVATED",
    "path": "nmeetingAfdDefault",
    "value": true
  }]
}
Update Operator with valid, DEACTIVATED nmeeting settings
Given I am authenticated as Admin
And there is Operator C0002 with
  • nmeeting: FLATRATE
  • nmeetingCustomerDefault: FLATRATE
  • nmeetingAfdDefault: true
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "nmeeting",
    "value": "DEACTIVATED"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "DEACTIVATED"
  }, {
    "name": "nmeetingAfdDefault",
    "value": false
  }]
}
Then I should receive HTTP/1.1 204 No Content

Given I am authenticated as Admin
When I send /api/operators/C0002
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "data": [{
    "name": "nmeeting",
    "value": "DEACTIVATED"
  }, {
    "name": "nmeetingCustomerDefault",
    "value": "DEACTIVATED"
  }, {
    "name": "nmeetingAfdDefault",
    "value": false
  }]
}
Customer cannot update Operator's data
Given I am authenticated as Customer K0002
When I send /api/operators/C0002
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 [Operator] with id [C0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot update Operator's data
Given I am authenticated as System Integrator S0002
When I send /api/operators/C0002
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 [Operator] with id [C0002]",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Operator cannot update Operator's data
Given I am authenticated as Operator C0002
When I send /api/operators/C0002
with application/json; charset=UTF-8 and body:
{}
Then I should receive HTTP/1.1 403 Forbidden
with following body:
{
  "title": "Access forbidden",
  "detail": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Admin cannot update not existing Operator's data
Given I am authenticated as Admin
And there is no Operator C0404 When I send /api/operators/C0404
with application/json; charset=UTF-8 and body:
{}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Operator not found",
  "detail": "Operator C0404 has not been found",
  "described_by": "http://api.nfon.net/probs/operator-not-found"
}