/api/customers/K0002/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then I should receive
HTTP/1.1 201 Created
/api/customers/K0002/targets/phone-extensions/201/function-keys/1{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/external/0048.22.100-456"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "SPEEDDIAL"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then I should receive
HTTP/1.1 201 Created
/api/customers/K0002/targets/phone-extensions/201/function-keys/1{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/external/0048.22.100-456?id=9"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "SPEEDDIAL"
}, {
"name": "displayName",
"value": "Call John"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "displayName",
"value": "Invoke Function"
}, {
"name": "functionCode",
"value": "*80"
}]
}
Then response code should be equal
HTTP/1.1 201 Created
/api/customers/K0002/targets/phone-extensions/201/function-keys/1
will return
{
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "displayName",
"value": "Invoke Function"
}, {
"name": "functionCode",
"value": "*80"
}]
}
/api/customers/K0404/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then response code should be equal
HTTP/1.1 404 Not Foundapplication/api-problem+json{
"described_by": "http://api.nfon.net/probs/customer-not-found",
"title": "Customer not found",
"detail": "Customer with identifier K0404 has not been found"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys
application/json; charset=UTF-8
{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then response code should be equal
HTTP/1.1 404 Not Foundapplication/api-problem+json{
"title": "Extension not found",
"detail": "Extension with extension number 201 has not been found",
"described_by": "http://api.nfon.net/probs/extension-not-found"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys
application/json; charset=UTF-8
{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys
application/json; charset=UTF-8
{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John2"
}]
}
Then response code should be equal
HTTP/1.1 404 Not Foundapplication/api-problem+json
And response should look like:
{
"title": "Function Key assignment already assigned",
"detail": "Extension 201 has already defined assignment for key 1",
"described_by": "http://api.nfon.net/probs/function-key-assignment-already-assigned"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys
application/json; charset=UTF-8
{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1410
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then response code should be equal
HTTP/1.1 400 Bad Requestapplication/api-problem+json{
"detail": "Could not create or update resource due to constraint violations",
"title": "Validation error",
"errors": [{
"message": "Invalid value for keyNumber",
"detailMessage": "Value of keyNumber should be between 0 and 1023 but 1410 was provided",
"path": "keyNumber",
"value": null
}],
"described_by": "http://api.nfon.net/probs/validation-error"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "INVALID"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Unknown enum value. Allowed values: [SPEEDDIAL, MONITOR, INTERCOM, SERVICE, FUNCTION_CODE]",
"path": "type",
"value": "INVALID"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Target is required for this type",
"path": "target"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": ""
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Target is required for this type",
"path": "target"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Function code is required for this type",
"path": "functionCode"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "functionCode",
"value": ""
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Function code is required for this type",
"path": "functionCode"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "functionCode",
"value": "123"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Function code is not allowed for type MONITOR",
"path": "functionCode"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "functionCode",
"value": "123"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Target is not allowed for type FUNCTION_CODE",
"path": "target"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "SERVICE"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "For given target [PHONEEXTENSION] the type of Key Assignment should be: [MONITOR, INTERCOM]"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/queue-services/701"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "For given target [QUEUE] the type of Key Assignment should be: [SERVICE]"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/external/invalid"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "SPEEDDIAL"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"title": "Incorrect Phone Number",
"detail": "Phone Number [invalid] is incorrect",
"described_by": "http://api.nfon.net/probs/incorrect-phone-number"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "SPEEDDIAL"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"title": "Invalid resource type",
"detail": "Resource at /api/customers/K0002 is of incorrect type",
"described_by": "http://api.nfon.net/probs/invalid-resource-type"
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "functionCode",
"value": "+123"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Function code has incorrect format",
"path": "functionCode",
"value": "+123"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keys application/json; charset=UTF-8 {
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/BUSY"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}]
}
Then response code should be equal HTTP/1.1 400 Bad Request{
"errors": [{
"message": "Target BUSY is not allowed to be assigned to Function Key. It should be one of: [CONFERENCE, GROUP, IVR, PHONEEXTENSION, QUEUE, SKILL, TIMECONTROL]",
"path": "target"
}]
}
/api/customers/K0002/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"links": [{
"rel": "target",
"href": "/api/customers/K0002/targets/phone-extensions/201"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then I should get HTTP/1.1 403 Forbidden {
"title": "Access forbidden",
"detail": "Access denied to [Customer] with id [K0002]",
"described_by": "http://api.nfon.net/probs/invalid-authorization"
}
/api/customers/K0002/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"links": [{
"rel": "target",
"href": "/api/customers/K0003/targets/phone-extensions/405"
}],
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "MONITOR"
}, {
"name": "displayName",
"value": "Call John"
}]
}
Then I should get HTTP/1.1 400 Bad Request {
"errors": [{
"message": "Target does not belong to Customer K0002",
"path": "target"
}]
}
/api/customers/K0003/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "displayName",
"value": "Invoke Function"
}, {
"name": "functionCode",
"value": "*80"
}]
}
Then I should receive HTTP/1.1 403 Forbidden {
"title": "Access forbidden",
"detail": "Access denied to [Customer] with id [K0003]",
"described_by": "http://api.nfon.net/probs/invalid-authorization"
}
/api/customers/K0003/targets/phone-extensions/201/function-keysapplication/json; charset=UTF-8{
"data": [{
"name": "keyNumber",
"value": 1
}, {
"name": "type",
"value": "FUNCTION_CODE"
}, {
"name": "displayName",
"value": "Invoke Function"
}, {
"name": "functionCode",
"value": "*80"
}]
}
Then I should receive HTTP/1.1 403 Forbidden {
"title": "Access forbidden",
"detail": "Access denied to [Customer] with id [K0003]",
"described_by": "http://api.nfon.net/probs/invalid-authorization"
}