Offices
Create An Office
$ 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"
}'
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"
}
$ echo '{
"identifier" : "Kigali",
"name" : "Kigali And Sons MFI",
"description" : "Sons Of Kigali MFI"
}' | http POST 'http://localhost:8080/offices' 'Content-Type:application/json'
Path | Type | Description |
---|---|---|
|
|
Employee’s identifier |
|
|
Employee given name |
|
|
Employee’s middle name |
HTTP/1.1 202 Accepted
Find An Office
$ curl 'http://localhost:8080/offices/MyOffice' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /offices/MyOffice HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/offices/MyOffice' 'Content-Type:application/json' 'Accept:*/*'
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
}
Path | Type | Description |
---|---|---|
|
|
office’s identifier |
|
|
office name |
|
|
office description |
|
|
Parent’s branch |
|
|
Office’s address |
|
|
External references |
Update An Office
$ 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"
}'
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"
}
$ echo '{
"identifier" : "originalOffice",
"name" : "Updated Office",
"description" : "My Updated Office"
}' | http PUT 'http://localhost:8080/offices/originalOffice' 'Content-Type:application/json' 'Accept:application/json'
Path | Type | Description |
---|---|---|
|
|
office’s identifier |
|
|
office name |
|
|
office description |
HTTP/1.1 202 Accepted
Delete An Office
$ curl 'http://localhost:8080/offices/office007' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
DELETE /offices/office007 HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http DELETE 'http://localhost:8080/offices/office007' 'Content-Type:application/json' 'Accept:*/*'
HTTP/1.1 202 Accepted
Add A Branch
$ 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"
}'
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"
}
$ 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'
Path | Type | Description |
---|---|---|
|
|
office’s identifier |
|
|
office name |
|
|
office description |
|
|
Parent Office |
HTTP/1.1 202 Accepted
Get Branches
$ curl 'http://localhost:8080/offices/office001/branches' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /offices/office001/branches HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/offices/office001/branches' 'Content-Type:application/json' 'Accept:*/*'
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
}
Path | Type | Description |
---|---|---|
|
|
Page of offices |
|
|
first employee’s identifier |
|
|
Parent office |
|
|
first office’s name |
|
|
first branch’s description |
|
|
first branch’s address |
|
|
first branch’s external reference |
|
|
second employee’s identifier |
|
|
Parent office |
|
|
second office’s name |
|
|
second branch’s description |
|
|
second branch’s address |
|
|
second branch’s external reference |
|
|
Page of offices |
|
|
Page of offices |
Set An Office’s Address
$ 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"
}'
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"
}
$ 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'
Path | Type | Description |
---|---|---|
|
|
Street |
|
|
City |
|
|
Region |
|
|
Postal Code |
|
|
Country Code |
|
|
Country |
HTTP/1.1 202 Accepted
Find An Office’s Address
$ curl 'http://localhost:8080/offices/theOffice/address' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /offices/theOffice/address HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/offices/theOffice/address' 'Content-Type:application/json' 'Accept:*/*'
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"
}
Path | Type | Description |
---|---|---|
|
|
Street |
|
|
City |
|
|
Region |
|
|
Postal Code |
|
|
Country Code |
|
|
Country |
Delete An Office’s Address
$ curl 'http://localhost:8080/offices/officeToDelete/address' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
DELETE /offices/officeToDelete/address HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http DELETE 'http://localhost:8080/offices/officeToDelete/address' 'Content-Type:application/json' 'Accept:*/*'
HTTP/1.1 202 Accepted
Add External Reference
$ curl 'http://localhost:8080/offices/ourOffice/references' -i -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
"type" : "TypeOne",
"state" : "ACTIVE"
}'
PUT /offices/ourOffice/references HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Content-Length: 46
{
"type" : "TypeOne",
"state" : "ACTIVE"
}
$ echo '{
"type" : "TypeOne",
"state" : "ACTIVE"
}' | http PUT 'http://localhost:8080/offices/ourOffice/references' 'Content-Type:application/json' 'Accept:application/json'
Path | Type | Description |
---|---|---|
|
|
Type of reference |
|
|
State of reference |
HTTP/1.1 202 Accepted
Employees
Create An Employee
$ 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
} ]
}'
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
} ]
}
$ 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'
Path | Type | Description |
---|---|---|
|
|
Employee’s identifier |
|
|
Employee given name |
|
|
Employee’s middle name |
|
|
Employee’s surname |
|
|
Employee’s assigned office |
|
|
Employee’s contact details |
HTTP/1.1 202 Accepted
Find An Employee
$ curl 'http://localhost:8080/employees/emNo1' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /employees/emNo1 HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/employees/emNo1' 'Content-Type:application/json' 'Accept:*/*'
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
} ]
}
Path | Type | Description |
---|---|---|
|
|
first employee’s identifier |
|
|
first employee given name |
|
|
first employee’s middle name |
|
|
first employee’s surname |
|
|
first employee’s assigned office |
|
|
first employee’s contact details |
Find All Employees
$ curl 'http://localhost:8080/employees' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /employees HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/employees' 'Content-Type:application/json' 'Accept:*/*'
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
}
Path | Type | Description |
---|---|---|
|
|
Page of employees |
|
|
first employee’s identifier |
|
|
first employee given name |
|
|
first employee’s middle name |
|
|
first employee’s surname |
|
|
first employee’s assigned office |
|
|
first employee’s contact details |
|
|
second employee’s identifier |
|
|
second employee given name |
|
|
second employee’s middle name |
|
|
second employee’s surname |
|
|
second employee’s assigned office |
|
|
second employee’s contact details |
|
|
Page of Employees |
|
|
Page of Employees |
Update An Employee
$ 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}]}'
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}]}
$ 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'
Path | Type | Description |
---|---|---|
|
|
first employee’s identifier |
|
|
first employee given name |
|
|
first employee’s middle name |
|
|
first employee’s surname |
|
|
first employee’s assigned office |
|
|
first employee’s contact details |
HTTP/1.1 202 Accepted
Delete An Employee
$ curl 'http://localhost:8080/employees/employeeNo2' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: application/json'
DELETE /employees/employeeNo2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
$ http DELETE 'http://localhost:8080/employees/employeeNo2' 'Content-Type:application/json' 'Accept:application/json'
HTTP/1.1 202 Accepted
Update Employee’s Contact Detail
$ 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}]'
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}]
$ 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/1.1 202 Accepted
Delete Employee’s Contact Detail
$ curl 'http://localhost:8080/employees/employeeNo4/contacts' -i -X DELETE -H 'Content-Type: application/json' -H 'Accept: */*'
DELETE /employees/employeeNo4/contacts HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http DELETE 'http://localhost:8080/employees/employeeNo4/contacts' 'Content-Type:application/json' 'Accept:*/*'
HTTP/1.1 202 Accepted
List Employee’s Contact Details
$ curl 'http://localhost:8080/employees/empNoThree/contacts' -i -H 'Content-Type: application/json' -H 'Accept: */*'
GET /employees/empNoThree/contacts HTTP/1.1
Content-Type: application/json
Accept: */*
Host: localhost:8080
$ http GET 'http://localhost:8080/employees/empNoThree/contacts' 'Content-Type:application/json' 'Accept:*/*'
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
} ]
Path | Type | Description |
---|---|---|
|
|
Type of first contact |
|
|
Group of first contact |
|
|
Value of first contact |
|
|
Preference level of first contact |
|
|
Type of second contact |
|
|
Group of second contact |
|
|
Value of second contact |
|
|
Preference level of second contact |