Api >

Service Portal REST API

Admin can create Lync Gateway with POST
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
and authenticated call to /api/customers/K0002/lync/gateways/200 should return:
{
  "href": "/api/customers/K0002/lync/gateways/200",
  "links": [],
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Lync Gateway IP must not be per Customer
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as Admin
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway B"
  }, {
    "name": "gatewayIp",
    "value": "one.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": "one.nfon.net"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Lync Gateway IP and description must not be unique across whole application
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as Admin
When I send /api/customers/K0003/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Lync Gateway can be created without description
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Only one Lync Gateway can be created without description
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as Admin
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "gatewayIp",
    "value": "two.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": "Description is not unique",
    "path": "description",
    "value": null
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Lync Gateway description when provided must be unique
Given I am authenticated as Admin
and next available identifier for Lync Gateway is 200
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.nfon.net"
  }]
}
Then I should receive HTTP/1.1 201 Created
Given I am authenticated as Admin
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "two.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": "Description is not unique",
    "path": "description"
  }],
  "described_by": "http://api.nfon.net/probs/validation-error"
}
Fail meaningfully when trying to create Lync Gateway for not existing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.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 create Lync Gateways
Given I am authenticated as customer K0002
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.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 create Lync Gateways
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.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 create Lync Gateways
Given I am authenticated as Operator C0002
When I send /api/customers/K0002/lync/gateways as application/json; charset=UTF-8 with following body:
{
  "data": [{
    "name": "description",
    "value": "Lync Gateway A"
  }, {
    "name": "gatewayIp",
    "value": "one.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"
}