Api >

Service Portal REST API

Admin can modify Lync Gateway
Given I am authenticated as Admin
and there is a Lync Gateway with id 200 and name Lync Gateway
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
Then I should receive HTTP/1.1 204 No Content
and authenticated call to /api/customers/K0002/lync/gateways/200 should return:
{
  "href": "/api/customers/K0002/lync/gateways/200",
  "links": [],
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
Cannot duplicate description while updating Lync Gateway
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
and there is a Lync Gateway with name Lync Gateway and IP one.nfon.net
and there is a another Lync Gateway with name Other Lync Gateway and IP other.nfon.net
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Other Lync Gateway"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Validation error",
  "detail": "Could not create or update resource due to constraint violations",
  "errors": [{
    "message": "Description is not unique",
    "path": "description"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Cannot duplicate IP while updating Lync Gateway
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
and there is a Lync Gateway with name Lync Gateway and IP one.nfon.net
and there is a another Lync Gateway with name Other Lync Gateway and IP other.nfon.net
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "gatewayIp",
    "value": "other.nfon.net"
  }]
}
Then I should receive HTTP/1.1 400 Bad Request
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Validation error",
  "detail": "Could not create or update resource due to constraint violations",
  "errors": [{
    "message": "GatewayIp is not unique",
    "path": "gatewayIp",
    "value": "other.nfon.net"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Cannot update not existing Lync Gateway
Given I am authenticated as Admin
When I send /api/customers/K0002/lync/gateways/404 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
Then I should receive HTTP/1.1 404 Not Found
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Lync Gateway not found",
  "detail": "Lync Gateway with id 404 not found",
  "described_by": "http://api.nfon.net/probs/lync-gateway-not-found"
}
Cannot update Lync Site for not existing Customer
Given I am authenticated as Admin
and there is a Lync Gateway with id 200 and name Lync Gateway
When I send /api/customers/K0404/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
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 modify Lync Gateway
Given I am authenticated as customer K0002
and there is a Lync Gateway with id 200 and name Lync Gateway
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden
And Content-Type header should be application/api-problem+json
with following body:
{
  "title": "Access forbidden",
  "detail": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
System Integrator cannot update Lync Gateway
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
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"
}
Operator cannot update Lync Gateway
Given I am authenticated as Operator C0002
When I send /api/customers/K0002/lync/gateways/200 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "New Description"
  }, {
    "name": "gatewayIp",
    "value": "new.nfon.net"
  }]
}
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"
}