Api >

Service Portal REST API

POST assigns Inbound Trunk Number to Conference Service
Given I am authenticated as customer K0002
and there is a Conference Service with service number 17
and there is an unassigned Inbound Trunk Number +48 (22) 1111-5
When I send /api/customers/K0002/targets/conference-services/17/inbound-trunk-numbers as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.1111.0-9"
  }],
  "data": [{
    "name": "didExtension",
    "value": "5"
  }]
}
Then I should receive HTTP/1.1 201 Created with http://localhost:9998/api/customers/K0002/targets/conference-services/17/inbound-trunk-numbers/0048.22.1111-5
with following body:
{
  "href": "/api/customers/K0002/targets/conference-services/17/inbound-trunk-numbers/0048.22.1111-5"
}
and Inbound Trunk Number is assigned to Conference Service
Missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/conference-services/17/inbound-trunk-numbers as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0404/trunks/0048.22.1111.0-9"
  }],
  "data": [{
    "name": "didExtension",
    "value": "5"
  }]
}
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"
}
POST returns 403 if Customer is trying to create Conference Service Inbound Trunk Number for other Customer
Given I am authenticated as K0003
When I send /api/customers/K0002/targets/conference-services/17/inbound-trunk-numbers as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0002/trunks/0048.22.1111.0-9"
  }],
  "data": [{
    "name": "didExtension",
    "value": "5"
  }]
}
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 create Conference Service Inbound Trunk Number for Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/conference-services/17/inbound-trunk-numbers as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0003/trunks/0048.22.1111.0-9"
  }],
  "data": [{
    "name": "didExtension",
    "value": "5"
  }]
}
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 create Conference Service Inbound Trunk Number for Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/conference-services/17/inbound-trunk-numbers as application/json; charset=UTF-8 with following body:
{
  "links": [{
    "rel": "trunk",
    "href": "/api/customers/K0003/trunks/0048.22.1111.0-9"
  }],
  "data": [{
    "name": "didExtension",
    "value": "5"
  }]
}
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"
}