We recommend using this inside a virtual environment.
On a Linux system: If you want to create one and use:
virtualenv venv -p python3
source venv/bin/activate
with pip installed:
make run
this command will install all dependencies, run tests and start the API.
All responses will have the form:
{
"message": "message describing what happened",
"data": "data returned"
}
Definition
GET /company
http://localhost:5000/company?company_name=HUT&zipcode=44667
Arguments
"company_name":str
- Company name"zipcode":str
- Five digit text zipcode
Responses
200 OK
- In success (If zipcode or company_name are not passed, retrieves all companies)404 NOT FOUND
- When a resource is not found
{
"message": "Success",
"data": [
{
"id": 6,
"company_name": "PIZZA HUT",
"zipcode": "44667",
"website": "https://www.pizzahut.com"
}
]
}
Definition
PUT /company
{
"csvpath": "q2_clientData.csv"
}
Arguments
"csvpath":str
- Name of the csv file to be processed
Responses
200 OK
- Success, companies added400 BAD REQUEST
- Cannot process the given file404 NOT FOUND
- File doesn't exist/ There is no data to update in the database
{
"message": "Success",
"updated": [
{
"id": 1,
"company_name": "TOLA SALES GROUP",
"zipcode": "78229",
"website": "http://repsources.com"
},
{
"id": 5,
"company_name": "SAINT PAUL RADIOLOGY",
"zipcode": "55109",
"website": "http://stpaulradiology.com"
},
{
"id": 6,
"company_name": "PIZZA HUT",
"zipcode": "44667",
"website": "https://www.pizzahut.com"
},
Definition
POST /company/data
{
"csvpath": "q1_catalog.csv"
}
Arguments
"csvpath":str
- Name of the csv file to be processed
Responses
201 CREATED
- Success, companies added400 BAD REQUEST
- Cannot process the given file
{
"message":"Success, companies added",
"data":[
{
"id":1,
"company_name":"TOLA SALES GROUP",
"zipcode":"78229",
"website":null
},
{
"id":2,
"company_name":"FOUNDATION CORRECTIONS INC",
"zipcode":"94002",
"website":null
},
{
"id":3,
"company_name":"DWIGHT HARRISON VW",
"zipcode":"30078",
"website":null
}
]
}
Definition
DELETE /company/data
Arguments
- This endpoint takes no arguments
Responses
200 OK
- Success, database cleared
{
"message": "Success, database cleared",
"data": []
}