Skip to content

TeamRU API Endpoints

Anitej Biradar edited this page Feb 28, 2021 · 12 revisions

All requests must be made by passing a valid LCS token in with the headers.

Format: {"token": ""}

Endpoints

/users

GET [DISABLED]

Retrieves all available users in TeamRU. Filter by query parameters.

Query Parameters:

  • limit [optional] Number of profiles to be returned (when missing, no limit)
  • hasateam [optional] Only users in teams, or only users not in teams (when missing, return both)

Returns:

Situation Value HTTP Code Type
Success {"user_profiles: [ ... ]} 200 application/json

POST

Creates a new user profile.

Example Request Body:

{
    "skills": ["java", "python", "flask"],
    "prizes": ["prize1", "prize2", "prize3"],
    "bio": "Hi there!",
    "github": "https://github.com/<username>",
    "interests": ["Blockchain", "Machine Learning"],
    "seriousness": 4
}

Notes:

  • Fields in the POST body that are not recognized will be silently ignored.

Returns:

Situation Value HTTP Code Type
Success {"message": "User profile successfully created"} 201 application/json
User already exists {"error": "User already exists"} 400 application/json

/users/profile

GET

Retrieves a single user profile.

Returns:

Situation Value HTTP Code Type
Success {"user_id": "johndoe@hackru.org", "skills": ["java", "python", "flask"], "prizes": ["prize1", "prize2", "prize3"], "bio": "Hi there!", "github": "https://github.com/<username>", "interests": ["Blockchain", "Machine Learning"], "seriousness": 4, "team_id": "qwerty12345", "hasateam": false} 200 application/json
User not found {"error": "User not found"} 404 application/json

PUT

Updates a single user profile.

Example Request Body:

{
    "skills": ["java", "python", "html", "css"],
    "prizes": ["prize1", "prize2", "prize3"],
    "bio": "Hi there!",
    "github": "https://github.com/<username>",
    "interests": ["Blockchain", "Machine Learning"],
    "seriousness": 5
}

Notes:

  • Only fields that are included in the body will be updated, existing fields in the user object will remain unaffected.
  • For fields with lists of values, the PUT body must contain the entire list that should be stored with the user profile, not just the latest addition. For example, if a user's existing skills are ["java", "python"] and they want to add "javascript", the PUT request must contain all three values: {"skills": ["java", "python", "javascript"]}.
  • Fields in the PUT body that are not recognized will be silently ignored.

Returns:

Situation Value HTTP Code Type
Success {"message": "User profile successfully updated"} 200 application/json
User not found {"error": "User not found"} 404 application/json

/teams

GET

Retrieves all available teams in TeamRU. Filter by query parameters.

Query Parameters:

  • offset [optional | default 0] Number of teams to skip before selecting teams for the response
  • limit [optional | default 10] Number of teams in the response

Returns:

Situation Value HTTP Code Type
Success {"all_open_teams": [ ... ]} 200 application/json
No open teams {"message": "No open teams"} 400 application/json

POST

Creates a new team profile.

Example Request Body:

{
    "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"],
}

Notes:

  • Fields in the POST body that are not recognized will be silently ignored.

Returns:

Situation Value HTTP Code Type
Success {"message": "Team profile successfully created"} 201 application/json
User not found in TeamRU {"message": "User does not exist"} 404 application/json
User already belongs to a team {"message": "User in a team"} 400 application/json

/teams/<team_id>

GET

Retrieves a single team profile of the specified team.

Returns:

Situation Value HTTP Code Type
Success {"team_id": "qwerty12345", "name": "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": [{"user_id": "test1@gmail.com", "bio": "", "seriousness": 3},{"user_id": "test2@gmail.com", "bio": "", "seriousness": 3}, {"user_id": "test3@gmail.com", "bio": "", "seriousness": 3}], "skills": ["python", "flask"], "prizes": ["prize9", "prize8"], "outgoing_inv": ["qwerty23456", "poiuyt23456"], "incoming_inv": ["yuioip7890", "asdfghj2345678"]} 200 application/json
Team does not exist {"message": "Team does not exist"} 400 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json

PUT

Updates a single team profile of the specified user.

Example Request Body:

{
    "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"]
}

Notes:

  • Only fields that are included in the body will be updated, existing fields in the team object will remain unaffected.
  • For fields with lists of values, the PUT body must contain the entire list that should be stored with the team profile, not just the latest addition. For example, if a team's existing prizes are ["prize1", "prize2"] and they want to add "prize3", the PUT request must contain all three values: {"prizes": ["prize1", "prize2", "prize3"]}.
  • Fields in the PUT body that are not recognized will be silently ignored.

Returns:

Situation Value HTTP Code Type
Success {"message": "Team profile successfully updated"} 200 application/json
Team does not exist {"message": "Team does not exist"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json

/teams/<team_id>/complete

PUT

  • If a team is currently NOT labeled complete, this operation will set the team's complete field to True.
  • If a team IS currently labeled complete, this operation will set the team's complete field to False.
  • Returns the completion status of the team after performing the operation (True|False).

Returns:

Situation Value HTTP Code Type
Success - Team complete is now True {"message": "True"} 200 application/json
Success - Team complete is now False {"message": "False"} 200 application/json
Team does not exist {"message": "Team does not exist"} 400 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json

/teams/<team_id>/leave

PUT

Removes the user making the request from the team specified by team_id.

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
Team does not exist {"message": "Team does not exist"} 400 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json

/teams/<team_id>/invite

POST

Send an invite to another team. <team_id> is the team making the invite.

Example Request Body:

{
    "team2_id": "qwerty12345"
}

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
Invalid team id(s) {"message": "Invalid team id(s)"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json
Team size too big {"message": "Team size will be greater than 4"} 409 application/json
Team(s) already complete {"message": "Team already complete"} 409 application/json

/teams/<team_id>/invite/user

POST

Send an invite to a single user via email. <team_id> is the team making the invite.

Example Request Body:

{
    "user_email": "johndoe@hackru.org"
}

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
User email does not exist {"message": "User <user_email> does not exist"} 404 application/json
User email in a team already {"message": "User <user_email> already on a team with others"} 409 application/json
Invalid team id(s) {"message": "Invalid team id(s)"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json
Team size too big {"message": "Team size will be greater than 4"} 409 application/json
Team(s) already complete {"message": "Team already complete"} 409 application/json

/teams/<team_id>/confirm

POST

Confirm an invite from another team. <team_id> is the team confirming the invite.

Example Request Body:

{
    "team2_id": "qwerty12345"
}

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
Invalid team id(s) {"message": "Invalid team id(s)"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json
Team size too big {"message": "Team size will be greater than 4"} 409 application/json
Team(s) already complete {"message": "Team complete"} 409 application/json
Invite no longer exists {"message": "Invite no longer exists"} 404 application/json

/teams/<team_id>/rescind

POST

Rescind an invite to another team. <team_id> is the team rescinding the invite.

Example Request Body:

{
    "team2_id": "qwerty12345"
}

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
Invalid team id(s) {"message": "Invalid team id(s)"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json
Invite has already been confirmed/rejected/rescinded {"message": "No invite to rescind"} 404 application/json

/teams/<team_id>/reject

POST

Reject an invite from another team. <team_id> is the team rejecting the invite.

Example Request Body:

{
    "team2_id": "qwerty12345"
}

Returns:

Situation Value HTTP Code Type
Success {"message": "Success"} 200 application/json
Invalid team id(s) {"message": "Invalid team id(s)"} 404 application/json
User not in team {"message": "User not in team <team_id>"} 403 application/json
Invite has already been confirmed/rejected/rescinded {"message": "No invite to reject"} 404 application/json

/matches/<team_id>

Returns recommended matches for a specific team.

Returns:

Situation Value HTTP Code Type
Success {"recommended": [ ... ]} 200 application/json