Nattapong Unaregul
The Best Practice EndPoint API
1 min readMar 27, 2020

--

The Best practice api is created for admiring the best endpoint created by some backend guy. I appreciate their work hard and creativity towards the world

Below is example endpoint .
https://thebestpracticeapi.azurewebsites.net/index.html

1 . [Get] User

  • Functional Requirement : Frontend calls this api to render user profile and info. The below is what JSON response backend expose to FrontEnd
{
"firstName": "baboro",
"lastName": "lycan",
"level": 0,
"isLockOut": "N"
}

FrontEnd : “What is the Level and is isLockOut”.

BackEnd : “To know the meaning, You should better call /BestPractice/config

FrontEnd : “I try and get response look like this. Why don’t you expose direct message instead of asking another the meaning from additional endpoint”

{
"level": {
"normal": 0,
"owner": 1,
"superAdmin": 2
},
"isLockOut": {
"y": "Yes",
"n": "No"
}
}

BackEnd : “Listen, Sending 0/1 or y/n is to save the chunk of binary across the network so the client will cost a little on their internet service provider”

BackEnd : “Lets say this, 0 take 4 Bytes. normal take 48 Bytes. So we can save 44 Bytes at a time per request and this is the best practice

BackEnd : “One last thing, You should map at the client side too.”

2. [POST] Creating Member and return the result

  • Functional Requirement : After creating. API should response what frontend created.

Request

{
"firstName" : "Chicken",
"lastName" : "DotA",
"picture" : "base64 jpeg,xxx",
"age" : 36,
}

Response

[]

--

--