Api >

Service Portal REST API

PUT updates new Group Service
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345 and name Group Service
When I send /api/customers/K0002/targets/group-services/345 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service Name"
  }]
}
Then I should receive HTTP/1.1 204 No Content
And Group Service with Service Number 345 has name New Group Service Name
PUT updates new Group Service (basic fields)
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "extensionNumber",
    "value": "345"
  }, {
    "name": "displayName",
    "value": "New Group Service Name"
  }, {
    "name": "pickUpGroup",
    "value": true
  }]
}
Then I should receive HTTP/1.1 204 No Content
Then authenticated /api/customers/K0002/targets/group-services/345 should return:
{
  "data": [{
    "name": "extensionNumber",
    "value": "345"
  }, {
    "name": "displayName",
    "value": "New Group Service Name"
  }, {
    "name": "pickUpGroup",
    "value": true
  }]
}
Cannot update Group Service if Display Name is missing
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": ""
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Display name is missing",
    "path": "displayName"
  }]
}
Cannot update Group Service if Display Name contains invalid characters
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "invalid?name"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Display name should not contain these characters: & $ ! ? = | \" { }",
    "path": "displayName",
    "value": "invalid?name"
  }]
}
Cannot update Group Service if Display Name is too long
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "way, way, way, way, way, way, way, way, way too long name"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Display name should have a length between 1 and 50 characters",
    "path": "displayName",
    "value": "way, way, way, way, way, way, way, way, way too long name"
  }]
}
Cannot update Group Service if Extension Number has invalid format
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }, {
    "name": "extensionNumber",
    "value": "0345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Invalid extension number format. Must not start with the dial-out-prefix (default 0)",
    "path": "extensionNumber",
    "value": "0345"
  }]
}
Cannot update Group Service if Extension Number is too long
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }, {
    "name": "extensionNumber",
    "value": "12345678909876543212345"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Extension number length should not exceed 20 characters",
    "path": "extensionNumber",
    "value": "12345678909876543212345"
  }]
}
Cannot update Group Service if Extension Number is duplicated
Given I am authenticated as Customer K0002
and there is a Group Service with service number 345
and there is another Group Service with Extension 123
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }, {
    "name": "extensionNumber",
    "value": "123"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request and application/api-problem+json with following body:
{
  "errors": [{
    "message": "Extension number is not unique.",
    "path": "extensionNumber",
    "value": "123"
  }]
}
Cannot update missing Group Service
Given I am authenticated as Customer K0002
When I send /api/customers/K0002/targets/group-services/404 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }]
}
Then I should receive HTTP/1.1 404 Not Found with following body:
{
  "title": "Group not found",
  "detail": "Group with serviceNumber 404 not found",
  "described_by": "http://api.nfon.net/probs/group-not-found"
}
Admin cannot update Group Service for missing Customer
Given I am authenticated as Admin
and there is a Group Service with service number 345
When I send /api/customers/K0404/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }, {
    "name": "extensionNumber",
    "value": "123"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
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 create Group Service for another Customer
Given there is a Group Service with service number 345
and I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/group-services/345 with application/json; charset=UTF-8 and following body:
{
  "data": [{
    "name": "displayName",
    "value": "New Group Service"
  }, {
    "name": "extensionNumber",
    "value": "123"
  }]
}
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 update Group Service of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/group-services/345 with application/json; charset=UTF-8 and following 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 Group Service of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/group-services/345 with application/json; charset=UTF-8 and following 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"
}