POST /teams/:teamId/join

Description

Join a team.

You must specify the roles with which you want to join the team. The roles available to join depend on the team definition.

If the team is public then the updated team state and the player's updated teams is returns. If the team is protected then a generated approval request to join the team is returned. If the team is private an error is returned.

For more information about how team joining works check out Team Basics

Resource URL

https://api.playlyfe.com/teams/:teamId/join

Method

POST

Scopes

player, game, debug

LocationParameter NameDefault ValueDescription
QueryteamIdThe team ID
Request Bodyroles[]The list of roles which the player wishes to join as.

Example

Joining a public team
Request
POST https://api.playlyfe.com/teams/anonymous/join?debug=true
{
  "roles": ["hacker"]
}
Response
[
  {
    "internationl|1": {
      "anonymous": {
        "hacker": 0
      }
    }
  },
  {
    "id": "anonymous",
    "name": "Anonymous"
    "definition": "internationl",
    "version": 1,
    "created": "2013-11-10T16:42:10.570Z",
    "access": "PUBLIC",
    "owner": "anonops",
    "locked": false,
    "member_count": {
      "hacker": 15380
    },
    "total_members": 15380
  }
]
"""
Joining a protected team
Request
POST https://api.playlyfe.com/teams/nypd/join
{
  "roles": ["officer", "member"]
}
Response
{
  "team": {
    "id": "nypd",
    "name": "New York Police Department"
  },
  "player": {
    "id": "robo_cop",
    "alias": "Robo Cop"
  },
  "state": "PENDING",
  "roles": ["officer", "member"],
  "id": "520512b563c67d641e000002"
}
Joining a private teamId
Request
POST https://api.playlyfe.com/teams/avengers/join
{
  "roles": ["hero"]
}
Response
Status: 401
{
  "error": "access_denied",
  "error_description": "You cannot join the private team 'con-artists'"
}