Api >

Service Portal REST API

Admin with PUT updates requested Customer Contract's name
Given I am authenticated as Admin
and there is a Customer Contract with salesForceId 800D0000003ARnKIAW and name Contract and subId 2
When I send /api/customers/K0002/contracts/800D0000003ARnKIAW with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "name",
    "value": "New Contract"
  }]
}
Then I should receive HTTP/1.1 204 No Content
And authenticated call to /api/customers/K0002/contracts/800D0000003ARnKIAW returns HTTP/1.1 200 OK with following body:
{
  "data": [{
    "name": "name",
    "value": "New Contract"
  }]
}
PUT returns 404 when Contract does not exists
Given I am authenticated as Admin
When I send /api/customers/K0002/contracts/404 with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "name",
    "value": "New Contract"
  }]
}
Then I should receive HTTP/1.1 404 Not Found and following body:
{
  "title": "Customer contract not found",
  "detail": "Customer contract with salesForceId 404 has not been found for Customer K0002",
  "described_by": "http://api.nfon.net/probs/customer-contract-not-found"
}
PUT returns 403 for non-admin users
Given I am authenticated as K0002
and there is a Customer Contract with salesForceId 800D0000003ARnKIAW and subId 2
When I send /api/customers/K0002/contracts/800D0000003ARnKIAW with application/json; charset=UTF-8 and body:
{
  "data": [{
    "name": "name",
    "value": "New Contract"
  }]
}
Then I should receive HTTP/1.1 403 Forbidden and following body:
{
  "title": "Access forbidden",
  "detail": "Required role is missing",
  "described_by": "http://api.nfon.net/probs/invalid-authorization"
}
Cannot update Contract for missing Customer
Given I am authenticated as Admin
When I send /api/customers/K0404/contracts/800D0000003ARnKIAW with application/json; charset=UTF-8 and body:
{}
Then I should receive HTTP/1.1 404 Not Found
with following body:
{
  "described_by": "http://api.nfon.net/probs/customer-not-found",
  "title": "Customer not found",
  "detail": "Customer with identifier K0404 has not been found"
}