Api >

Service Portal REST API

Read site data
Given I am authenticated as K0002
And there is a Site with salesforceId a062000000HbAsd
And with:
  • name set to Site Name
  • street set to Site Street
  • zip set to 00999
  • city set to Berlin
  • country set to DE
  • state set to state
  • azc set to 10
  • ndc set to 987
When I send /api/customers/K0002/sites/a062000000HbAsd
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/customers/K0002/sites/a062000000HbAsd",
  "links": [{
    "rel": "siteOptions",
    "href": "/api/customers/K0002/sites/a062000000HbAsd/site-options"
  }],
  "data": [{
    "name": "name",
    "value": "Site Name"
  }, {
    "name": "salesforceId",
    "value": "a062000000HbAsd"
  }, {
    "name": "street",
    "value": "Site Street"
  }, {
    "name": "zip",
    "value": "00999"
  }, {
    "name": "city",
    "value": "Berlin"
  }, {
    "name": "country",
    "value": "DE"
  }, {
    "name": "azc",
    "value": "10"
  }, {
    "name": "ndc",
    "value": "987"
  }]
}
Read mobile site data
Given I am authenticated as K0002
When I send /api/customers/K0002/sites/1
Then I should receive HTTP/1.1 200 OK
with following body
{
  "href": "/api/customers/K0002/sites/1",
  "links": [{
    "rel": "siteOptions",
    "href": "/api/customers/K0002/sites/1/site-options"
  }],
  "data": [{
    "name": "name",
    "value": "Dummy site K0002"
  }, {
    "name": "salesforceId",
    "value": "1"
  }, {
    "name": "street",
    "value": ""
  }, {
    "name": "zip",
    "value": ""
  }, {
    "name": "city",
    "value": ""
  }, {
    "name": "country",
    "value": ""
  }, {
    "name": "azc",
    "value": ""
  }, {
    "name": "ndc",
    "value": null
  }]
}
Cannot read other Account Site data
Given there is a Site with salesforceId a062000000HbAsd
And I am authenticated as Customer K0003
When I send /api/customers/K0002/sites/a062000000HbAsd
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"
}
Cannot read other customer Mobile Site data
Given I am authenticated as Customer K0003
When I send /api/customers/K0002/sites/1
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"
}
Missing Customer
Given I am authenticated as Admin
and there is no customer with ID K404
When I send /api/customers/K404/sites/a062000000HbAsd
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "title": "Customer not found",
  "detail": "Customer with identifier K404 has not been found",
  "described_by": "http://api.nfon.net/probs/customer-not-found"
}
Missing Site
Given I am authenticated as Customer K0002
and there is no Site with salesforceID abcde000404
When I send /api/customers/K0002/sites/abcde000404
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "detail": "Site [abcde000404] not found for Customer [K0002]",
  "described_by": "http://api.nfon.net/probs/site-not-found"
}
System Integrator cannot access Site of Customer that does not belong to him
Given I am authenticated as System Integrator S0002
When I send /api/customers/K0003/sites/abcde000404
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 access Site of Customer that does not belong to him
Given I am authenticated as Operator C0002
When I send /api/customers/K0003/sites/abcde000404
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"
}