HeadSpin Documentation
Documentation

Team API

API Reference

List all teams

List devices assigned to all teams

List devices for a team

Add devices to a team

Remove devices from a team

List all teams

Route Method
/v0/teams GET

Example


curl 'https://<your_api_token>@api-dev.headspin.io/v0/teams'

Response

A JSON object in the form of <code class="dcode">{"teams": [...]}</code> that contains a list of teams. Example:


{
  "teams": [
    {
      "team_name": "{team_name}",
      "team_id": "{team_id}"
    },
    ...
  ]
}

List devices assigned to all teams

This will only list devices with team assignments. To list all available devices, please refer to the Basic Device API.

Route Method
/v0/teams/devices GET

Example


curl 'https://<your_api_token>@api-dev.headspin.io/v0/teams/devices'

Response

A JSON object in the form of <code class="dcode">{"devices": [{"device-address":[...], "teams":[...]}...]}</code> that contains a list of devices and their team assignments. Example:


{
  "devices": [
    {
        "device_address": "{android-device-id}@{android-device-serial}",
        "teams": [{
            "team_id": "{team_id}",
            "team_name": "{team_name}"
        }, ...]
    }
    ...
  ]
}

List devices for a team

Route Method
/v0/team/{team_id}/devices GET

Example


curl -X GET https://<your_api_token>@api-dev.headspin.io/v0/team/{team_id}/devices

Response

A JSON object in the form of <code class="decode">{"device_addresses":[...]}</code> containing a list of device addresses. Example:


{
  "device_addresses": [
      "{android-device-id}@{android-device-serial}",
      "{ios-device-id}@{hostname}",
      ...
  ]
}

Add devices to a team

Route Method
/v0/team/{team_id}/devices/add PATCH

Request Body

  • A JSON object in the form of <code class="dcode">{"device_addresses":[...]}</code> containing a list of devices to assign to the team.

Example


curl -X PATCH https://<your_api_token>@api-dev.headspin.io/v0/team/{team_id}/devices/add -d '{"device_addresses": ["{android-device-id}@{android-device-serial}", "{ios-device-id}@{hostname}"]}'

Response

A JSON object containing an array of devices added to the team. Example:


{"added_devices": [{"device_address": "{android-device-id}@{android-device-serial}"}, {"device_address": "{ios-device-id}@{hostname}"}]}

Remove devices from a team

Route Method
/v0/team/{team_id}/devices/remove DELETE

Request Body

  • A JSON object in the form of <code class="dcode">{"device_addresses":[...]}</code> containing a list of devices to remove from the team.`

Example


curl -X DELETE https://<your_api_token>@api-dev.headspin.io/v0/team/{team_id}/devices/remove -d '{"device_addresses": ["{android-device-id}@{android-device-serial}", "{ios-device-id}@{hostname}"]}'

Response

A JSON object containing an array of devices removed from the team. Example:


{"removed_devices": [{"device_address": "{android-device-id}@{android-device-serial}"}, {"device_address": "{ios-device-id}@{hostname}"}]}