Python Screen Test
Python Screen Test
You can implement this rest api using any one of the following
method.
● aws apigateway and lambda
● DJANGO REST FRAMEWORK
TASK:
Note:
● write code using exception handling only, without exception handling
we wont cosider.
● Write comments for each method
● Use camelCase for variables and function names
1. Create an employe conditions:
A. Dont allow duplicate employe registrations, check with email.
B. Datatype of keys should be matched as per the table, if not u have
to send 400 status code bad request.
C. Every key is required for creating an employe, if not u have to send
400 status code, bad request
D. Method: POST
name string
email string
age int
gender string
phoneNo string
addressDetails dictionary
hno string
street string
city string
state string
companyName string
fromDate string
toDate string
address string
qualificationName string
percentage double
title string
description string
RESPONSE FORMAT:
● If the data type and require params missing in json, then send
400 status code
{“message”:”invalid body request”,
“sucess”:false}
2. UPDATE AN EMPLOYEE
Description: you have to update an employee using regid.
REQUEST JSON FORMAT:
Same json we used for create an employee with regid as extra
key. Because we have to update employee using this key.
REQUEST METHOD: PUT
RESPONSE FORMAT:
● If the data type and require params missing in json, then send
400 status code
{“message”:”invalid body request”,
“sucess”:false}
3.DELETE AN EMPLOYEE
● If the data type and require params missing in json, then send
400 status code
{“message”:”invalid body request”,
“sucess”:false}
REQUEST FORMAT:
Single employee request : ?regid=EMP001
All employee request:
REQUEST METHOD: GET
RESPONSE FORMAT:
● If we found an employee details then send like
Status code: 200
{ “message”:”employee details found”,
“success”:true,
“employees”:[{
"name": "",
"age": "",
"gender": "",
"phoneNo": "",
"addressDetails": {
"hno": "",
"street": "",
"city": "",
"state": ""
},
"workExperience": [
{
"companyName": "xyz",
"fromDate": "20-05-2019",
"toDate": "20-09-2021",
"address": "xyz"
}
]"qualifications": [
{
"qualificationName": "ssc",
"fromDate": "20-05-2012",
"toDate": "20-05-2013",
"percentage": 85
}
],
"projects": [
{
"titile": "xyz",
"description": "description of the project"
}
],
"photo": ""
}
]
}