Skip to content

Developers

How can we help you?

← Go back

Team

Note: Only BeBanjo accounts configured for User Permissions will expose teams in the API.

A Team is a user grouping feature. Unlimited teams can be created, each identified by a name. A user can be a member of multiple teams. Teams can be renamed or removed, and different privilege levels (e.g., admin, contributor, viewer) can be set for each user.

This is how a team looks like:

<?xml version="1.0" encoding="UTF-8"?>
<team>
  <id type="integer">140</id>
  <name>Contributors</name>
  <avatar-color>red</avatar-color>
  <avatar-url nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/teams/140"/>
  <link rel="users" href="https://movida.bebanjo.net/api/teams/140/users"/>
</team>
{
  "resource_type": "team",
  "id": 140,
  "name": "Contributors",
  "avatar_color": "red",
  "avatar_url": null,
  "self_link": "https://movida.bebanjo.net/api/teams/140",
  "users_link": "https://movida.bebanjo.net/api/teams/140/users"
}

The self link is pointing to the team itself, and it is a unique URL that will not change overtime.

Note: This resource links can be expanded using the expand option.

Valid attributes

  • id (required): BeBanjo internal identifier of the team.

  • name (required): the name of the team.

  • avatar-color (optional): the color for the default avatar image of the team. Possible values are “yellow”, “orange”, “red”, “pink”, “purple”, “aqua”, “blue” and “green”. When the avatar-color is present, the avatar-url will be empty.

  • avatar-url (optional): the URL for the avatar image of the team. It can be an absolute or relative URL that represents the avatar of the team. When using a relative URL, the oauth provider host is preprended. When the avatar-url is present, the avatar-color will be empty.

Get a list of all teams in the current account

Teams are linked from the root of the API, through the link identified with the rel="teams" attribute:

<?xml version="1.0" encoding="UTF-8"?>
<movida>
  <!-- ... -->
  <link rel="teams" href="https://movida.bebanjo.net/api/teams">
</movida>
{
  // ...
  "teams_link": "https://movida.bebanjo.net/api/teams",
  // ...
}

Following that link, we can fetch the list of teams in the current account.

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/teams
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/teams
<?xml version="1.0" encoding="UTF-8"?>
<teams type="array">
  <total-entries>132</total-entries>
  <link rel="next" href="https://movida.bebanjo.net/api/teams?page=1"/>
  <link rel="prev" href="https://movida.bebanjo.net/api/teams?page=3"/>
  <team>
    <id type="integer">137</id>
    <name>BeBanjo</name>
    <avatar-color>orange</avatar-color>
    <avatar-url nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/teams/137"/>
    <link rel="users" href="https://movida.bebanjo.net/api/teams/137/users"/>
  </team>
  <team>
    <id type="integer">140</id>
    <name>Contributors</name>
    <avatar-color>red</avatar-color>
    <avatar-url nil="true"/>
    <link rel="self" href="https://movida.bebanjo.net/api/teams/140"/>
    <link rel="users" href="https://movida.bebanjo.net/api/teams/140/users"/>
  </team>
  <!-- ... -->
<team>
{
  "total_entries": 132,
  "prev_link": "https://movida.bebanjo.net/api/teams?page=1",
  "next_link": "https://movida.bebanjo.net/api/teams?page=3",
  "entries": [
    {
      "resource_type": "team",
      "id": 137,
      "name": "BeBanjo",
      "avatar_color": "orange",
      "avatar_url": null,
      "self_link": "https://movida.bebanjo.net/api/teams/137",
      "users_link": "https://movida.bebanjo.net/api/teams/137/users"
    },
    {
      "resource_type": "team",
      "id": 140,
      "name": "Contributors",
      "avatar_color": "red",
      "avatar_url": null,
      "self_link": "https://movida.bebanjo.net/api/teams/140",
      "users_link": "https://movida.bebanjo.net/api/teams/140/users"
    },
    // ...
  ]
}

Note: This is a paginated resource. By default, only 50 teams will be included in each page but you can override this default by using the per_page parameter described in the next section. The total-entries attribute will indicate the total number of entries and the links rel="next" and rel="prev" should be used to get the next and the previous pages.

You can filter the list of teams returned using the following attributes:

  • per_page: Number of elements returned in each page. The maximum value allowed is 200 and the default is 50.

Get a single team given its URL

The self link of a team contains a URL that will allow us to fetch that individual team:

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/teams/123
$ curl --digest -u robot_user:password -H "Accept: application/json" https://movida.bebanjo.net/api/teams/123
<?xml version="1.0" encoding="UTF-8"?>
<team>
  <id type="integer">140</id>
  <name>Contributors</name>
  <avatar-color>red</avatar-color>
  <avatar-url nil="true"/>
  <link rel="self" href="https://movida.bebanjo.net/api/teams/140"/>
  <link rel="users" href="https://movida.bebanjo.net/api/teams/140/users"/>
</team>
{
  "resource_type": "team",
  "id": 140,
  "name": "Contributors",
  "avatar_color": "red",
  "avatar_url": null,
  "self_link": "https://movida.bebanjo.net/api/teams/140",
  "users_link": "https://movida.bebanjo.net/api/teams/140/users"
}