Offices

Create An Office

curl-request
$ curl 'http://localhost:8080/offices' -i -X POST -H 'Content-Type: application/json' -d '{
  "identifier" : "Kigali",
  "name" : "Kigali And Sons MFI",
  "description" : "Sons Of Kigali MFI"
}'
http-request
POST /offices HTTP/1.1
Content-Type: application/json
Host: localhost:8080
Content-Length: 103

{
  "identifier" : "Kigali",
  "name" : "Kigali And Sons MFI",
  "description" : "Sons Of Kigali MFI"
}
httpie-request
$ echo '{
  "identifier" : "Kigali",
  "name" : "Kigali And Sons MFI",
  "description" : "Sons Of Kigali MFI"
}' | http POST 'http://localhost:8080/offices' 'Content-Type:application/json'
Table 1. request-fields
Path Type Description

identifier

String

Employee’s identifier

name

String

Employee given name

description

String

Employee’s middle name

http-response
HTTP/1.1 202 Accepted

Find An Office

curl-request
$ curl 'http://localhost:8080/offices/MyOffice' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /offices/MyOffice HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/offices/MyOffice' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 171

{
  "identifier" : "MyOffice",
  "parentIdentifier" : null,
  "name" : "My Office",
  "description" : "My Own Office",
  "address" : null,
  "externalReferences" : false
}
Table 2. response-fields
Path Type Description

identifier

String

office’s identifier

name

String

office name

description

String

office description

parentIdentifier

String

Parent’s branch

address

Address

Office’s address
class Address {
private String street
private String city
private String region
private String postalCode
private String countryCode
private String country
}

externalReferences

Boolean

External references

Update An Office

curl-request
$ curl 'http://localhost:8080/offices/originalOffice' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "identifier" : "originalOffice",
  "name" : "Updated Office",
  "description" : "My Updated Office"
}'
http-request
PUT /offices/originalOffice HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 105

{
  "identifier" : "originalOffice",
  "name" : "Updated Office",
  "description" : "My Updated Office"
}
httpie-request
$ echo '{
  "identifier" : "originalOffice",
  "name" : "Updated Office",
  "description" : "My Updated Office"
}' | http PUT 'http://localhost:8080/offices/originalOffice' 'Content-Type:application/json' 'Accept:application/json'
Table 3. request-fields
Path Type Description

identifier

String

office’s identifier

name

String

office name

description

String

office description

http-response
HTTP/1.1 202 Accepted

Delete An Office

curl-request
$ curl 'http://localhost:8080/offices/office007' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
DELETE /offices/office007 HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http DELETE 'http://localhost:8080/offices/office007' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 202 Accepted

Add A Branch

curl-request
$ curl 'http://localhost:8080/offices/parentOffice' -i -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "identifier" : "Branch",
  "parentIdentifier" : "parentOffice",
  "name" : "Branch To Add",
  "description" : "Branch To Be Added"
}'
http-request
POST /offices/parentOffice HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 136

{
  "identifier" : "Branch",
  "parentIdentifier" : "parentOffice",
  "name" : "Branch To Add",
  "description" : "Branch To Be Added"
}
httpie-request
$ echo '{
  "identifier" : "Branch",
  "parentIdentifier" : "parentOffice",
  "name" : "Branch To Add",
  "description" : "Branch To Be Added"
}' | http POST 'http://localhost:8080/offices/parentOffice' 'Content-Type:application/json' 'Accept:application/json'
Table 4. request-fields
Path Type Description

identifier

String

office’s identifier

name

String

office name

description

String

office description

parentIdentifier

String

Parent Office

http-response
HTTP/1.1 202 Accepted

Get Branches

curl-request
$ curl 'http://localhost:8080/offices/office001/branches' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /offices/office001/branches HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/offices/office001/branches' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 833

{
  "offices" : [ {
    "identifier" : "firstBranch",
    "parentIdentifier" : "office001",
    "name" : "First Branch",
    "description" : "First Branch Of MFI",
    "address" : {
      "street" : "Rue De Vie",
      "city" : "Bandjoun",
      "region" : "West Region",
      "postalCode" : "8050",
      "countryCode" : "HO",
      "country" : "Cameroon"
    },
    "externalReferences" : false
  }, {
    "identifier" : "secondBranch",
    "parentIdentifier" : "office001",
    "name" : "Second Branch",
    "description" : "Second Branch Of MFI",
    "address" : {
      "street" : "Rue Du Bon",
      "city" : "Baham",
      "region" : "West Region",
      "postalCode" : "8050",
      "countryCode" : "78",
      "country" : "Cameroon"
    },
    "externalReferences" : false
  } ],
  "totalPages" : 1,
  "totalElements" : 2
}
Table 5. response-fields
Path Type Description

offices

Array

Page of offices

offices[].identifier

String

first employee’s identifier

offices[].parentIdentifier

String

Parent office

offices[].name

String

first office’s name

offices[].description

String

first branch’s description

offices[].address

Address

first branch’s address
class Address {
private String street
private String city
private String region
private String postalCode
private String countryCode
private String country
}

offices[].externalReferences

Boolean

first branch’s external reference

offices[1].identifier

String

second employee’s identifier

offices[1].parentIdentifier

String

Parent office

offices[1].name

String

second office’s name

offices[1].description

String

second branch’s description

offices[1].address

Address

second branch’s address
class Address {
private String street
private String city
private String region
private String postalCode
private String countryCode
private String country
}

offices[1].externalReferences

Boolean

second branch’s external reference

totalPages

Integer

Page of offices

totalElements

Integer

Page of offices

Set An Office’s Address

curl-request
$ curl 'http://localhost:8080/offices/originalOffice/address' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "street" : "New Street",
  "city" : "New City",
  "region" : "New region",
  "postalCode" : "8050",
  "countryCode" : "lN",
  "country" : "Cameroon"
}'
http-request
PUT /offices/originalOffice/address HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 154

{
  "street" : "New Street",
  "city" : "New City",
  "region" : "New region",
  "postalCode" : "8050",
  "countryCode" : "lN",
  "country" : "Cameroon"
}
httpie-request
$ echo '{
  "street" : "New Street",
  "city" : "New City",
  "region" : "New region",
  "postalCode" : "8050",
  "countryCode" : "lN",
  "country" : "Cameroon"
}' | http PUT 'http://localhost:8080/offices/originalOffice/address' 'Content-Type:application/json' 'Accept:application/json'
Table 6. request-fields
Path Type Description

street

String

Street

city

String

City

region

String

Region

postalCode

String

Postal Code

countryCode

String

Country Code

country

String

Country

http-response
HTTP/1.1 202 Accepted

Find An Office’s Address

curl-request
$ curl 'http://localhost:8080/offices/theOffice/address' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /offices/theOffice/address HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/offices/theOffice/address' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 152

{
  "street" : "The Street",
  "city" : "The City",
  "region" : "The Region",
  "postalCode" : "8085",
  "countryCode" : "Qj",
  "country" : "Gambia"
}
Table 7. response-fields
Path Type Description

street

String

Street

city

String

City

region

String

Region

postalCode

String

Postal Code

countryCode

String

Country Code

country

String

Country

Delete An Office’s Address

curl-request
$ curl 'http://localhost:8080/offices/officeToDelete/address' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
DELETE /offices/officeToDelete/address HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http DELETE 'http://localhost:8080/offices/officeToDelete/address' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 202 Accepted

Add External Reference

curl-request
$ curl 'http://localhost:8080/offices/ourOffice/references' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
  "type" : "TypeOne",
  "state" : "ACTIVE"
}'
http-request
PUT /offices/ourOffice/references HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 46

{
  "type" : "TypeOne",
  "state" : "ACTIVE"
}
httpie-request
$ echo '{
  "type" : "TypeOne",
  "state" : "ACTIVE"
}' | http PUT 'http://localhost:8080/offices/ourOffice/references' 'Content-Type:application/json' 'Accept:application/json'
Table 8. request-fields
Path Type Description

type

String

Type of reference

state

String

State of reference

http-response
HTTP/1.1 202 Accepted

Employees

Create An Employee

curl-request
$ curl 'http://localhost:8080/employees' -i -X POST -H 'Content-Type: application/json' -d '{
  "identifier" : "employ001",
  "givenName" : "Chale",
  "middleName" : "Asamoah",
  "surname" : "Yamoah",
  "assignedOffice" : "Accra",
  "contactDetails" : [ {
    "type" : "MOBILE",
    "group" : "PRIVATE",
    "value" : "677889900",
    "preferenceLevel" : 1
  } ]
}'
http-request
POST /employees HTTP/1.1
Content-Type: application/json
Host: localhost:8080
Content-Length: 272

{
  "identifier" : "employ001",
  "givenName" : "Chale",
  "middleName" : "Asamoah",
  "surname" : "Yamoah",
  "assignedOffice" : "Accra",
  "contactDetails" : [ {
    "type" : "MOBILE",
    "group" : "PRIVATE",
    "value" : "677889900",
    "preferenceLevel" : 1
  } ]
}
httpie-request
$ echo '{
  "identifier" : "employ001",
  "givenName" : "Chale",
  "middleName" : "Asamoah",
  "surname" : "Yamoah",
  "assignedOffice" : "Accra",
  "contactDetails" : [ {
    "type" : "MOBILE",
    "group" : "PRIVATE",
    "value" : "677889900",
    "preferenceLevel" : 1
  } ]
}' | http POST 'http://localhost:8080/employees' 'Content-Type:application/json'
Table 9. request-fields
Path Type Description

identifier

String

Employee’s identifier

givenName

String

Employee given name

middleName

String

Employee’s middle name

surname

String

Employee’s surname

assignedOffice

String

Employee’s assigned office

contactDetails

List<ContactDetail>

Employee’s contact details

http-response
HTTP/1.1 202 Accepted

Find An Employee

curl-request
$ curl 'http://localhost:8080/employees/emNo1' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /employees/emNo1 HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/employees/emNo1' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 264

{
  "identifier" : "emNo1",
  "givenName" : "Ojong",
  "middleName" : "Cho",
  "surname" : "Tah",
  "assignedOffice" : "myOffice",
  "contactDetails" : [ {
    "type" : "MOBILE",
    "group" : "PRIVATE",
    "value" : "699009900",
    "preferenceLevel" : 1
  } ]
}
Table 10. response-fields
Path Type Description

identifier

String

first employee’s identifier

givenName

String

first employee given name

middleName

String

first employee’s middle name

surname

String

first employee’s surname

assignedOffice

String

first employee’s assigned office

contactDetails

List<ContactDetail>

first employee’s contact details

Find All Employees

curl-request
$ curl 'http://localhost:8080/employees' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /employees HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/employees' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 658

{
  "employees" : [ {
    "identifier" : "employ001",
    "givenName" : "Oru",
    "middleName" : "Asam",
    "surname" : "Yoah",
    "assignedOffice" : "office001",
    "contactDetails" : [ {
      "type" : "MOBILE",
      "group" : "PRIVATE",
      "value" : "677889900",
      "preferenceLevel" : 1
    } ]
  }, {
    "identifier" : "employ002",
    "givenName" : "Oyadipo",
    "middleName" : "Okah",
    "surname" : "Omo",
    "assignedOffice" : "office001",
    "contactDetails" : [ {
      "type" : "MOBILE",
      "group" : "PRIVATE",
      "value" : "675859565",
      "preferenceLevel" : 2
    } ]
  } ],
  "totalPages" : 1,
  "totalElements" : 2
}
Table 11. response-fields
Path Type Description

employees

Array

Page of employees

employees[].identifier

String

first employee’s identifier

employees[].givenName

String

first employee given name

employees[].middleName

String

first employee’s middle name

employees[].surname

String

first employee’s surname

employees[].assignedOffice

String

first employee’s assigned office

employees[].contactDetails

List<ContactDetail>

first employee’s contact details

employees[1].identifier

String

second employee’s identifier

employees[1].givenName

String

second employee given name

employees[1].middleName

String

second employee’s middle name

employees[1].surname

String

second employee’s surname

employees[1].assignedOffice

String

second employee’s assigned office

employees[1].contactDetails

List<ContactDetail>

second employee’s contact details

totalPages

Integer

Page of Employees

totalElements

Integer

Page of Employees

Update An Employee

curl-request
$ curl 'http://localhost:8080/employees/emNo1' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"identifier":"emNo1","givenName":"Ojong","middleName":"Cho","surname":"Tah","assignedOffice":"myOffice","contactDetails":[{"type":"PHONE","group":"BUSINESS","value":"677557755","preferenceLevel":1}]}'
http-request
PUT /employees/emNo1 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 200

{"identifier":"emNo1","givenName":"Ojong","middleName":"Cho","surname":"Tah","assignedOffice":"myOffice","contactDetails":[{"type":"PHONE","group":"BUSINESS","value":"677557755","preferenceLevel":1}]}
httpie-request
$ echo '{"identifier":"emNo1","givenName":"Ojong","middleName":"Cho","surname":"Tah","assignedOffice":"myOffice","contactDetails":[{"type":"PHONE","group":"BUSINESS","value":"677557755","preferenceLevel":1}]}' | http PUT 'http://localhost:8080/employees/emNo1' 'Content-Type:application/json' 'Accept:application/json'
Table 12. request-fields
Path Type Description

identifier

String

first employee’s identifier

givenName

String

first employee given name

middleName

String

first employee’s middle name

surname

String

first employee’s surname

assignedOffice

String

first employee’s assigned office

contactDetails

List<ContactDetail>

first employee’s contact details

http-response
HTTP/1.1 202 Accepted

Delete An Employee

curl-request
$ curl 'http://localhost:8080/employees/employeeNo2' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json'
http-request
DELETE /employees/employeeNo2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
httpie-request
$ http DELETE 'http://localhost:8080/employees/employeeNo2' 'Content-Type:application/json' 'Accept:application/json'
http-response
HTTP/1.1 202 Accepted

Update Employee’s Contact Detail

curl-request
$ curl 'http://localhost:8080/employees/employeeNo2/contacts' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: */*' -d '[{"type":"MOBILE","group":"PRIVATE","value":"699889988","preferenceLevel":1},{"type":"PHONE","group":"BUSINESS","value":"677557700","preferenceLevel":1}]'
http-request
PUT /employees/employeeNo2/contacts HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
Content-Length: 153

[{"type":"MOBILE","group":"PRIVATE","value":"699889988","preferenceLevel":1},{"type":"PHONE","group":"BUSINESS","value":"677557700","preferenceLevel":1}]
httpie-request
$ echo '[{"type":"MOBILE","group":"PRIVATE","value":"699889988","preferenceLevel":1},{"type":"PHONE","group":"BUSINESS","value":"677557700","preferenceLevel":1}]' | http PUT 'http://localhost:8080/employees/employeeNo2/contacts' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 202 Accepted

Delete Employee’s Contact Detail

curl-request
$ curl 'http://localhost:8080/employees/employeeNo4/contacts' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
DELETE /employees/employeeNo4/contacts HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http DELETE 'http://localhost:8080/employees/employeeNo4/contacts' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 202 Accepted

List Employee’s Contact Details

curl-request
$ curl 'http://localhost:8080/employees/empNoThree/contacts' -i -H 'Content-Type: application/json' -H 'Accept: */*'
http-request
GET /employees/empNoThree/contacts HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
httpie-request
$ http GET 'http://localhost:8080/employees/empNoThree/contacts' 'Content-Type:application/json' 'Accept:*/*'
http-response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 204

[ {
  "type" : "MOBILE",
  "group" : "BUSINESS",
  "value" : "6667667667",
  "preferenceLevel" : 1
}, {
  "type" : "EMAIL",
  "group" : "PRIVATE",
  "value" : "me@example.com",
  "preferenceLevel" : 2
} ]
Table 13. response-fields
Path Type Description

[].type

String

Type of first contact

[].group

String

Group of first contact

[].value

String

Value of first contact

[].preferenceLevel

Integer

Preference level of first contact

[1].type

String

Type of second contact

[1].group

String

Group of second contact

[1].value

String

Value of second contact

[1].preferenceLevel

Integer

Preference level of second contact