Api >

Service Portal REST API

GET retrieves a list of Time Control Services
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_orderBy=serviceNumber&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/345",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 345
    }, {
      "name": "serviceCode",
      "value": "*740345"
    }]
  }, {
    "href": "/api/customers/K0002/targets/time-control-services/678",
    "links": [],
    "data": [{
      "name": "name",
      "value": "another time control name"
    }, {
      "name": "displayName",
      "value": "another time control name"
    }, {
      "name": "extensionNumber",
      "value": "999"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 678
    }, {
      "name": "serviceCode",
      "value": "*740678"
    }]
  }]
}
GET retrieves a list of Time Control Services ordered by extensionNumber ascending
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services?_orderBy=extensionNumber&_order=asc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_orderBy=extensionNumber&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/345",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 345
    }, {
      "name": "serviceCode",
      "value": "*740345"
    }]
  }, {
    "href": "/api/customers/K0002/targets/time-control-services/678",
    "links": [],
    "data": [{
      "name": "name",
      "value": "another time control name"
    }, {
      "name": "displayName",
      "value": "another time control name"
    }, {
      "name": "extensionNumber",
      "value": "999"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 678
    }, {
      "name": "serviceCode",
      "value": "*740678"
    }]
  }]
}
GET retrieves a list of Time Control Services ordered by extensionNumber descending
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services?_orderBy=extensionNumber&_order=desc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_orderBy=extensionNumber&_order=DESC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/678",
    "links": [],
    "data": [{
      "name": "name",
      "value": "another time control name"
    }, {
      "name": "displayName",
      "value": "another time control name"
    }, {
      "name": "extensionNumber",
      "value": "999"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 678
    }, {
      "name": "serviceCode",
      "value": "*740678"
    }]
  }, {
    "href": "/api/customers/K0002/targets/time-control-services/345",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 345
    }, {
      "name": "serviceCode",
      "value": "*740345"
    }]
  }]
}
GET retrieves a list of Time Control Services ordered by name ascending
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services?_orderBy=name&_order=asc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_orderBy=name&_order=ASC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/678",
    "links": [],
    "data": [{
      "name": "name",
      "value": "another time control name"
    }, {
      "name": "displayName",
      "value": "another time control name"
    }, {
      "name": "extensionNumber",
      "value": "999"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 678
    }, {
      "name": "serviceCode",
      "value": "*740678"
    }]
  }, {
    "href": "/api/customers/K0002/targets/time-control-services/345",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 345
    }, {
      "name": "serviceCode",
      "value": "*740345"
    }]
  }]
}
GET retrieves a list of Time Control Services ordered by name descending
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 345
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services?_orderBy=name&_order=desc
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_orderBy=name&_order=DESC",
  "offset": 0,
  "total": 2,
  "size": 2,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/345",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 345
    }, {
      "name": "serviceCode",
      "value": "*740345"
    }]
  }, {
    "href": "/api/customers/K0002/targets/time-control-services/678",
    "links": [],
    "data": [{
      "name": "name",
      "value": "another time control name"
    }, {
      "name": "displayName",
      "value": "another time control name"
    }, {
      "name": "extensionNumber",
      "value": "999"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 678
    }, {
      "name": "serviceCode",
      "value": "*740678"
    }]
  }]
}
GET retrieves filtered Customer's Time Controls
Filtering is done on fields :
  • name
  • serviceNumber
  • extensionNumber
Given I am authenticated as customer K0002
And there is a Time Control Service
  • with name time control name
  • with service number 18
  • and extension number 576
And there is another Time Control Service
  • with name another time control name
  • with service number 678
  • and extension number 999
When I send /api/customers/K0002/targets/time-control-services?_q=18
Then I should receive HTTP/1.1 200 OK
with following body:
{
  "href": "/api/customers/K0002/targets/time-control-services?_offset=0&_pagesize=16&_q=18&_orderBy=serviceNumber&_order=ASC",
  "offset": 0,
  "total": 1,
  "size": 1,
  "links": [{
    "rel": "availableDestinations",
    "href": "/api/customers/K0002/targets/time-control-services/available-destinations"
  }],
  "items": [{
    "href": "/api/customers/K0002/targets/time-control-services/18",
    "links": [],
    "data": [{
      "name": "name",
      "value": "time control name"
    }, {
      "name": "displayName",
      "value": "time control name"
    }, {
      "name": "extensionNumber",
      "value": "576"
    }, {
      "name": "type",
      "value": "TIME"
    }, {
      "name": "serviceNumber",
      "value": 18
    }, {
      "name": "serviceCode",
      "value": "*740018"
    }]
  }]
}
Admin cannot get list of Time Control Services of missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/targets/time-control-services
Then I should receive HTTP/1.1 404 Not Found
{
  "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 get list of another Customer's Time Control Services
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/targets/time-control-services
Then I should receive 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"
}
System Integrator cannot get list of Time Control Services for Customer, that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/targets/time-control-services
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"
}
Operator cannot get list of Time Control Services for Customer, that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/targets/time-control-services
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"
}