Units / Teams

German: “Teams”

Attributes

The representation contains among the standard fields also:

  • users (staff assigned to this team)
{
  "id": 909147861,
  "name": "C Office",
  "users": [
    {
      "id": 933590158,
      "firstname": "Tobias",
      "lastname": "Miesel",
      "email": "tobias@domain.com"
    },
    {
      "id": 933589599,
      "firstname": "Sabine",
      "lastname": "Schäuble",
      "email": "sabine@domain.com"
    }
  ],
  "created_at": "2018-10-17T09:33:46Z",
  "updated_at": "2018-10-17T09:33:46Z"
}

GET /units

Retrieve all teams:

curl -X GET \
  'https://{domain}.mocoapp.com/api/v1/units' \
  -H 'Authorization: Token token=YOUR_API_KEY'

This returns an array with complete team information (see Attributes).

Additionally, the following parameters can be supplied:

GET /units/{id}

Retrieve a single team:

curl -X GET \
  'https://{domain}.mocoapp.com/api/v1/units/{id}' \
  -H 'Authorization: Token token=YOUR_API_KEY'

POST /units

Create a unit:

curl -X POST \
  'https://{domain}.mocoapp.com/api/v1/units' \
  -H 'Authorization: Token token=YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "A great new team"
      }'

Assigning a user is possible by updating it with the unit_id attribute.

PUT /units/{id}

Update a unit:

curl -X PUT \
  'https://{domain}.mocoapp.com/api/v1/units/{id}' \
  -H 'Authorization: Token token=YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "A new name"
      }'

Fields are analogous to the POST request.

DELETE /users/{id}

Deleting a unit is only possible if no users are assigned to it. Move existing users to a different unit by updating them with the unit_id attribute.

curl -X DELETE \
  'https://{domain}.mocoapp.com/api/v1/units/{id}' \
  -H 'Authorization: Token token=YOUR_API_KEY'