- Install Composer from here
- Run
composer install
inside the source folder
- Request body has to have both a
username
andpassword
field
Returns:
# On Successful login (Status Code 200)
{
"username" : "<username>",
"type" : "<user type>",
"company" : "<only present if the user is a client>"
}
# On Unsuccessful login (Status Code 403)
{
"error": "<error message>"
}
Example:
GET on /api/index.php/locations/provinces
Return an array of provinces in the format: "Province Name (Abbreviation)"
- Use the query parameter
province
to get cities- Will not return values if the parameter is missing (404)
Example:
GET on /api/index.php/locations/cities?province=QC
Return an array of city names
Returns a list of employees who are managers
Returns:
# On Successful call (Status Code 200)
{
"id": "10000000",
"firstName": "Juan",
"lastName": "Vasquez",
"department": "Development",
"managerId": null,
"insurancePlan": "Premium Employee Plan"
}
# On Unsuccessful call (Status Code 404)
{
"error": "Employee with ID '<invalid ID>' was not found"
}
- Either use
manager
orlist
(can't use both at the same time)list
is a comma-separated list of employee IDs
- Whenever the list returned is empty, the status code 404 is used (not found)
Returns:
# Manager output
[
{
"id": "20000001",
"firstName": "Iman",
"lastName": "Oak",
"department": "Development",
"managerId": "10000000",
"insurancePlan": "Silver Employee Plan"
},
{
"id": "20000002",
"firstName": "Jas",
"lastName": "Abat",
"department": "Development",
"managerId": "10000000",
"insurancePlan": "Silver Employee Plan"
},
{
"id": "20000003",
"firstName": "Imadake",
"lastName": "Hamato",
"department": "Development",
"managerId": "10000000",
"insurancePlan": "Normal Employee Plan"
},
{
"id": "20000004",
"firstName": "Limchang",
"lastName": "Kim",
"department": "Development",
"managerId": "10000000",
"insurancePlan": "Normal Employee Plan"
}
]
# List output
[
{
"id": "10000000",
"firstName": "Juan",
"lastName": "Vasquez",
"department": "Development",
"managerId": null,
"insurancePlan": "Premium Employee Plan"
},
{
"id": "20000001",
"firstName": "Iman",
"lastName": "Oak",
"department": "Development",
"managerId": "10000000",
"insurancePlan": "Silver Employee Plan"
}
]
POST
updates the given employee (using its ID), bothcategory
andtype
need to be sentGET
will return a list of contracts matching the preferences set for the given employee
Returns:
{
"category": "<a category>",
"type": "<a type>"
}
POST
creates new client data into the client table & credentials data (using email & password) into the user_credentials table. Used fields in the clientForm.phpGET
returns list of Client Names (company_name) sorted in alphabetical order
Returns:
# POST
{
"name": "WolframAlpha",
"number": "5143250692",
"email": "wolframalpha@email.com",
"firstName": "James",
"lastName": "Carter",
"middleInitial": "M",
"city": "Quebec",
"province": "QC",
"lob": "Education"
}
# GET
[
"Air Canada",
"Apple Inc.",
"Digital Extremes",
"Essence",
"IKEA",
"Koryo",
"Manulife",
"Nike",
"Wallgreens",
"Walmart"
]
GET
loads client information wherecName
is a valid company namePOST
updates the client information with the namecName
(uses same fields as for client creation)
Result:
{
"name": "WolframAlpha",
"number": "5143250692",
"email": "wolframalpha@email.com",
"firstName": "James",
"lastName": "Carter",
"middleInitial": "M",
"city": "Quebec",
"province": "QC",
"lob": "Education"
}
POST
: implemented but untested. Should capture all non default information about a contract in the front end
cid
corresponds to the contract IDdeliv
corresponds to the target deliverable with the following possible values:first
for first deliverablessecond
for second deliverablesthird
for third deliverablesfourth
for fourth deliverables
- Only used to update the deliverables
- Use POST with simple payload
Payload:
{
"numDays" : "<number of days to complete deliverable>"
}
Returns:
{
"id": "1",
"company": "Apple Inc.",
"category": "Premium",
"serviceType": "Cloud",
"acv": "50000",
"initialAmount": "10000",
"startDate": "2017-01-19 03:14:07",
"firstDeliverable": 4,
"secondDeliverable": 4,
"thirdDeliverable": 4,
"fourthDeliverable": 3,
"score": null,
"manager": "10000000"
}
- Updates satisfaction score for the contract (only supports post)
Example payload:
{
"score":"4"
}
Returns:
{
"id": "1",
"company": "Apple Inc.",
"category": "Premium",
"serviceType": "Cloud",
"acv": "50000",
"initialAmount": "10000",
"startDate": "2017-01-19 03:14:07",
"firstDeliverable": "4",
"secondDeliverable": "4",
"thirdDeliverable": "5",
"fourthDeliverable": "5",
"score": "4",
"manager": "10000000"
}
GET
: shows a list of all the scores and contracts of a manager identified by their employee id{mid}
as well as the average score for the manager.
Returns:
{
"contracts": [
{
"id": "1",
"score": "5"
},
{
"id": "3",
"score": "5"
},
{
"id": "5",
"score": "5"
},
{
"id": "7",
"score": "5"
},
{
"id": "9",
"score": "5"
}
],
"average": "5.0000"
}
GET
: views contract information identified by contract id{cid}
POST
: updates contract information identified by contract id{cid}
GET
on/api/index.php/contracts/{cid}/delete
: views contract information identified by contract id{cid}
Returns:
{
"id" : "42",
"company" : "IKEA",
"category" : "Diamond",
"serviceType" : "Cloud",
"acv" : "40000",
"initialAmount" : "10000",
"startDate" : "2017-01-19 03:14:07",
"firstDeliverable" : null,
"secondDeliverable" : null,
"thirdDeliverable" : null,
"fourthDeliverable" : null,
"score" : null,
"manager" : "10000009"
}
GET
: returns a list of all the contracts signed by a company with the company name,{cName}
- NOTE :
...
signifies data points ommitted for the sake of conciseness
[
{
"id": "1",
"category": "Premium",
"serviceType": "Cloud",
"acv": "50000",
"initialAmount": "10000",
"startDate": "2017-01-19 03:14:07",
"firstDeliverable": "4",
"secondDeliverable": "4",
"thirdDeliverable": "5",
"fourthDeliverable": "5",
"score": "5",
"manager": "10000000"
},
{
"id": "2",
"category": "Premium",
"serviceType": "On-premises",
"acv": "55000",
"initialAmount": "15000",
"startDate": "2017-02-21 03:14:07",
"firstDeliverable": null,
"secondDeliverable": null,
"thirdDeliverable": null,
"fourthDeliverable": null,
"score": null,
"manager": "10000001"
}
]
GET
: retrieves contracts that match employees{eid}
preferences
GET Results:
[
{
"contract_id": "1",
"contract_category": "Premium",
"type_of_service": "Cloud",
"acv": "50000",
"initial_amount": "10000",
"service_start_date": "2017-01-19 03:14:07",
"first_deliv": "4",
"second_deliv": "4",
"third_deliv": "4",
"fourth_deliv": "3",
"score": "4",
"manager_id": "10000000",
"company_name": "Apple Inc."
},
{
"contract_id": "11",
"contract_category": "Premium",
"type_of_service": "Cloud",
"acv": "60000",
"initial_amount": "20000",
"service_start_date": "2017-08-19 03:14:07",
"first_deliv": null,
"second_deliv": null,
"third_deliv": null,
"fourth_deliv": null,
"score": null,
"manager_id": "10000002",
"company_name": "Air Canada"
},
{
"contract_id": "21",
"contract_category": "Premium",
"type_of_service": "Cloud",
"acv": "50000",
"initial_amount": "10000",
"service_start_date": "2017-01-19 03:14:07",
"first_deliv": null,
"second_deliv": null,
"third_deliv": null,
"fourth_deliv": null,
"score": null,
"manager_id": "10000004",
"company_name": "Koryo"
}
]
POST
inputs number of hours worked by employee{eid}
on contract{cid}
since last entry (added to the amount on db); Returns post-change assigned_contracts tupleGET
on/api/index.php/employees/{eid}/contracts/{cid}/delete
removes the given employee from the given contract Result:
# On POST
{
"employee_id": "20000001",
"contract_id": "11",
"hours_worked": "30"
}
# On GET (with /delete)
{
"<message or error>" : "<message content>"
}
GET
ouputs all assigned contract tuples of contracts assigned to employee{eid}
Result:
{
"employee_id": "20000001",
"contract_id": "11",
"hours_worked": "30"
}
- All the endpoints use the
GET
method
- Returns a list of companies with the highest number of contracts in their respective line of business
Returns:
[
{
"companyName": "Manulife",
"contracts": "10",
"lineOfBusiness": "Food"
},
{
"companyName": "Essence",
"contracts": "2",
"lineOfBusiness": "Retail"
},
{
"companyName": "Apple Inc.",
"contracts": "7",
"lineOfBusiness": "Tech"
},
{
"companyName": "Air Canada",
"contracts": "10",
"lineOfBusiness": "Travel"
}
]
- Returns a list of employees working on a contract in the given province
prov
prov
has the be the 2-letter abbreviation of the province
Returns:
[
{
"id": "20000017",
"firstName": "Samantha",
"lastName": "Ogilovich",
"department": "UI",
"managerId": "10000004",
"insurancePlan": "Silver Employee Plan"
},
{
"id": "20000018",
"firstName": "Tatiana",
"lastName": "Mann",
"department": "UI",
"managerId": "10000004",
"insurancePlan": "Silver Employee Plan"
},
{
"id": "20000019",
"firstName": "Jeannette",
"lastName": "Dore",
"department": "UI",
"managerId": "10000004",
"insurancePlan": "Normal Employee Plan"
}
]
- Returns a list of contracts created in the last 10 days
prov
has the be the 2-letter abbreviation of the province
Returns:
[
{
"contract_id": "11",
"contract_category": "Premium",
"type_of_service": "Cloud",
"acv": "60000",
"initial_amount": "20000",
"service_start_date": "2017-08-19 03:14:07",
"first_deliv": null,
"second_deliv": null,
"third_deliv": null,
"fourth_deliv": null,
"score": null,
"manager_id": "10000002",
"company_name": "Air Canada",
},
{
"contract_id": "21",
"contract_category": "Premium",
"type_of_service": "Cloud",
"acv": "50000",
"initial_amount": "10000",
"service_start_date": "2017-01-19 03:14:07",
"first_deliv": null,
"second_deliv": null,
"third_deliv": null,
"fourth_deliv": null,
"score": null,
"manager_id": "10000004",
"company_name": "Koryo"
}
]
- Returns a list of clients whose contracts have the highest satisfaction scores in that category, grouped by the cities of clients
Returns:
[
{
"companyName": "Manulife",
"averageScore": null,
"province": "AB",
"city": "Edmonton"
},
{
"companyName": "Koryo",
"averageScore": null,
"province": "QC",
"city": "Montreal"
},
{
"companyName": "Walmart",
"averageScore": null,
"province": "QC",
"city": "Quebec"
},
{
"companyName": "Air Canada",
"averageScore": null,
"province": "ON",
"city": "Rockland"
},
{
"companyName": "Wallgreens",
"averageScore": null,
"province": "SK",
"city": "Saskatoon"
},
{
"companyName": "Nike",
"averageScore": null,
"province": "ON",
"city": "Toronto"
},
{
"companyName": "Apple Inc.",
"averageScore": null,
"province": "ON",
"city": "Waterloo"
}
]