Skip to content

v0 TeamRU API

anitejb edited this page Sep 5, 2020 · 1 revision

TeamRU API Endpoints

All endpoints have the following situations
Situation Value HTTP Code Type
lcs Validate endpoint failed Invalid request 404 text/plain
This feature is disabled in the config file Feature is disabled 501 text/plain
This Value of the feature in the config file is neither 0 nor 1 Wrong Feature value 502 text/plain
User email, token or both were not passed to the endpoint Missing email or token 408 text/plain
Invalid Json/schema Invalid Json 505 text/plain

/user-profile

Method: GET, POST

GET is used to return a profile while POST is used to create and update a profile.
When updating a profile, you should send the old values in addition to the new ones.

Data: JSON

Example JSON for POST:

{
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "skills": "java, python, flask",
    "prizes": "prize1, prize2, prize2"
}

Example JSON for GET:

{
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

GET Returns:

Situation Value HTTP Code Type
User doesn't have a teamBuilder profile User Not found 401 text/plain
Profile returned {"_id": "[email protected]", "skills": ["java", "python", "flask"], "prizes": ["prize1", "prize2"], "hasateam": false, "name": "John", "potentialteams": ["team1", "team2"} 200 Application/JSON

POST Returns:

Situation Value HTTP Code Type
Skills not found Required info not found 400 text/plain
Profile updated successfully Successful update 200 text/plain
Profile created successfully Profile created 201 text/plain

/start-a-team

Method: POST

Data: JSON

Example JSON:

{
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "name": "team1",
    "desc": "hi, we are a team of two and plan on creating an android app. We are looking for someone who knows java or kotlin",
    "skills": "java, kotlin",
    "prizes": "prize1, prize2"
}

Returns:

Situation Value HTTP Code Type
Missing required information Required info not found 400 text/plain
User doesn't have a teamBuilder profile Invalid user 403 text/plain
Team with the same name already exists Invalid name 401 text/plain
User can't start a team while they are in one already User in a team 402 text/plain
Team created successfully Success 200 text/plain

/leave-team

Method: POST

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

Returns:

Situation Value HTTP Code Type
User not in a team User doesn't have a team 400 text/plain
User left team successfully Success 200 text/plain

/add-team-member

Method: POST

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "email": "[email protected]",
}

Returns:

Situation Value HTTP Code Type
Email is missing Required info not found 400 text/plain
lcs auth endpoint failed auth endpoint failed 401 text/plain
lcs read endpoint failed Partner doesn't have a hackru account 402 text/plain
User doesn't have a team User not in a team 405 text/plain
Team is either marked complete by hackers or has four members Team complete 403 text/plain
Partner in another team Partner in a team 406 text/plain
Hacker added successfully Success 200 text/plain

/team-complete

This endpoint reverses the status of the team in the database and returns the new status when the request is successful. It returns True if the team was marked incomplete but now marked complete, and False if the team was marked complete and now it is incomplete.

Method: POST

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

Returns:

Situation Value HTTP Code Type
User doesn't have a team User not in a team 401 text/plain
Team marked complete/incomplete successfully True or False 200 text/plain

/open-teams

Method: GET

Data: JSON

Example JSON:

{ 
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "filter": "java",
}

Returns:

Situation Value HTTP Code Type
No teams match up the filter No open teams 400 text/plain
profiles of open teams successfully returned [ { "_id": "team3", "complete": false, "desc": "hi, we are a team of two and plan on creating a web app. we are looking for someone who knows python and flask","members": ["[email protected]", "[email protected]"], "partnerskills": ["python", "flask"], "prizes": ["prize9", "prize8" ], "interested", ["[email protected], "[email protected]"]}, {"_id": "team5", "complete": false, "desc": "looking for somone who knows java and kotlin", "members": ["[email protected]"], "partnerskills": ["java", "kotlin"], "prizes": ["prize4"], "interested", ["[email protected], "[email protected]"]} ] 200 Application/JSON

/team-profile

Method: GET

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

Returns:

Situation Value HTTP Code Type
User not in a team Team Not found 400 text/plain
Team profile successfully returned {"_id": "team3", "complete": false, "desc": "hi, we are a team of five and plan on creating a web app. we are looking for someone who knows python and flask", "members": ["[email protected]","[email protected]", "[email protected]"], "names": ["test1 test1", "test2 test2", "test3 test3"], "partnerskills": ["python", "flask"], "prizes": ["prize9", "prize8"], "interested", ["[email protected], "[email protected]"]} 200 Application/JSON

/team-recommendations

Method: GET

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

Returns:

Situation Value HTTP Code Type
User doesn't have a teamBuilder profile Invalid user 403 text/plain
User has a team User in a team 401 text/plain
Couldn't find recommendations No recommendations found 400 text/plain
Team profiles successfully returned [ { "_id": "team3", "complete": false, "desc": "hi, we are a team of two and plan on creating a web app. we are looking for someone who knows python and flask","members": ["[email protected]", "[email protected]"], "partnerskills": ["python", "flask"], "prizes": ["prize9", "prize8" ], "interested", ["[email protected], "[email protected]"]}, {"_id": "team5", "complete": false, "desc": "looking for somone who knows java and kotlin", "members": ["[email protected]"], "partnerskills": ["java", "kotlin"], "prizes": ["prize4"], "interested", ["[email protected], "[email protected]"]} ] 200 Application/JSON

/individual_recommendations

Method: GET

Data: JSON

Example JSON:

{  
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf"
}

Returns:

Situation Value HTTP Code Type
User doesn't have a team User not in a team 400 text/plain
Team profile is not complete Profile not complete 401 text/plain
Couldn't find recommendations No recommendations found 402 text/plain
profiles successfully returned [{"_id": "[email protected]","hasateam": false,"name": "test1 test1", "potentialteams": [ ""],"prizes": ["prize6", "prize9","prize1"],"skills": ["java","python","frontend" ]},{"_id": "[email protected]", "hasateam": false, "name": "test1 test1", "potentialteams": ["team1", "team2" ], "prizes": ["prize9","prize20","prize7"], "skills": ["web", "html", "css"]} ] 200 Application/JSON

/interested

Method: POST

Data: JSON

Example JSON:

{ 
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "name": "team1",
}

Returns:

Situation Value HTTP Code Type
Team name is missing Missing inf 401 text/plain
Name provided is not correct Invalid name 402 text/plain
User has a team User in a team 403 text/plain
Team is complete Team complete 405 text/plain
Request is successful Success 200 text/plain

/confirm-member

Method: POST

Data: JSON

Example JSON:

{
    "user_email": "[email protected]",
    "token": "fvbnlfjnvfjnvf",
    "email": "[email protected]",
}

Returns:

Situation Value HTTP Code Type
Hacker email is missing Missing inf 401 text/plain
Team is complete Team complete 402 text/plain
Request is successful Success 200 text/plain