Caseblocks Logo

Team Membership

Team Memberships

The Team Memberships API is used to add and remove users to and from teams.

GET /case_blocks/team_memberships?ids={team_membership_id}&ids=…

Retrieves the list of team memberships associated with the account and specified by a list of ids. There is currently no API to retrieve all team memberships in one call.

To retrieve a team_memberships with ids 5 & 23:

curl {headers} https://login.caseblocks.com/case_blocks/team_memberships?ids%5B%5D=5&ids%5B%5D=23

In the example above ids%5B%5D= is the url-encoded version of ids[]=.

Parameters:

  • ids[] – a list of individual team membership IDs

The server will return a JSON payload similar to the one below:

{
    "team_memberships": [{
        "id": 5,
        "user_id": 3,
        "team_id": 6,
        "leader": null
    }, {
        "id": 23,
        "user_id": 3,
        "team_id": 7,
        "leader": null
    }]
}

In the response above the following fields are of note:

  • id – the unique identifier of the team membership
  • userid – the unique id of the user, retrievable by /case_blocks/users/{userid}
  • teamid – the unique id of the team, retrievable by /case_blocks/teams/{teamid}

GET /case_blocks/team_memberships/{team_membership_id}

Retrieves a specific team membership via its identifier.

To retrieve a specific membership:

curl {headers} https://login.caseblocks.com/case_blocks/team_memberships/8

Parameters:

  • team_membership_id – the identifier of the team membership you’re trying to retrieve.

The server will return a JSON payload similar to the one below:

{
    "team_membership": {
        "id": 8,
        "user_id": 3,
        "team_id": 6,
        "leader": null
    }
}

POST /case_blocks/team_memberships

Creates a new team membership, i.e. a user joins a team, using the JSON payload provided in the request.

curl -XPOST {headers} -d @new_team_membership.json https://login.caseblocks.com/case_blocks/team_memberships

JSON payload:

{
    "team_membership": {
        "user_id": 3,
        "team_id": 7
    }
}

The server will return a JSON payload similar to the one below:

{
    "team_membership": {
        "id": 12,
        "user_id": 3,
        "team_id": 7,
        "leader": null
    }
}

PUT /case_blocks/team_memberships/{user_id}

Updates the team membership indicated by the teammembershipid parameter in the URL. Allows for the reassigned between users and teams.

curl -XPUT {headers} -d @updated_team_membersip.json 'http://login.caseblocks.com/case_blocks/team_memberships/12'

Parameters:

  • team_membership_id – the identifier of the team membership you’re trying to update.

JSON payload:

{
    "team_membership": {
        "user_id": 3,
        "team_id": 99
    }
}

The JSON payload above shows the user leaving a previous team (e.g. with team_id=7) and joining another (with team_id=99).

The server will return a JSON payload similar to the one below:

{
    "team_membership": {
        "id": 12,
        "user_id": 3,
        "team_id": 99,
        "leader": null
    }
}

DELETE /case_blocks/team_memberships/{team_membership_id}

Deletes the team membership indicated by the team_membership_id parameter in the URL, effectively removing the user from the team.

curl -XDELETE {headers} 'http://login.caseblocks.com/case_blocks/team_memberships/12'

Parameters:

  • team_membership_id – the identifier of the team membership you’re trying to delete.