Api >

Service Portal REST API

Admin can modify Lync Site domain and description
Given I am authenticated as Admin
and there is a Lync Gateway with id 200 and name Lync Gateway
and there is a LyncSite with id 500 and name Lync Site
When I send /api/customers/K0002/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "new.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
Then I should receive HTTP/1.1 204 No Content
and authenticated call to /api/customers/K0002/lync/sites/500 should return:
{
  "href": "/api/customers/K0002/lync/sites/500",
  "links": [{
    "rel": "gateway",
    "href": "/api/customers/K0002/lync/gateways/200"
  }],
  "data": [{
    "name": "serverName",
    "value": "Lync Gateway"
  }, {
    "name": "domain",
    "value": "new.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
Cannot duplicate domain while updating Lync Site
Given I am authenticated as Admin
and there is a Lync Gateway with id 200 and name Lync Gateway
and there is a LyncSite with id 500 and name Lync Site
and there is a another LyncSite with name Another Lync Site and domain another.nfon.net
When I send /api/customers/K0002/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "another.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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": "LyncSite with given domain already exists",
    "path": "domain",
    "value": "another.nfon.net"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Customer cannot update Lync Site
Given I am authenticated as customer K0002
When I send /api/customers/K0002/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "new.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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"
}
Cannot update not existing Lync Site
Given I am authenticated as Admin
When I send /api/customers/K0002/lync/sites/404 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "another.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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 Site not found",
  "detail": "Lync Site with id 404 not found",
  "described_by": "http://api.nfon.net/probs/lync-site-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
and there is a LyncSite with id 500 and name Lync Site
When I send /api/customers/K0404/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "another.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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"
}
System Integrator cannot update Lync Site
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0002/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "new.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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 Site
Given I am authenticated as Operator C0002
When I send /api/customers/K0002/lync/sites/500 as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "domain",
    "value": "new.nfon.net"
  }, {
    "name": "description",
    "value": "Changed Lync Site"
  }]
}
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"
}