Skip to content

Team API Documentation

jholt456 edited this page Jun 19, 2012 · 15 revisions

Get a List of Teams

Gets all teams in the team thing system

End point
GET /api/team
Example

Request Parameters
None

Response
Returns an array of teams

[{"name":"A-Team",
  "id":2,
  "ownerId":10,
  "administrators":[11],
  "isPublic":false,
  "imagePath":"/images/GenericUserImage.gif"},
 {"name":"Demo Team",
  "id":10,
  "ownerId":10,
  "administrators":[10],
  "isPublic":true,
  "imagePath":"/images/GenericUserImage.gif"}]

Get a Team

Get the team with the specified teamId
Note now that we have end points for getting members and things, we can probably shorten this response significantly

End point
GET api/team/{teamId}
Example

Request Parameters
None

Response
Returns a single team and all associated data

{"name":"A-Team",
 "id":2,
 "teamMembers":[{"id":4,
                 "emailAddress":"test3@demo.com",
                 "fullName":"test test",
                 "role":"Viewer", 
                 "imagePath":"/images/GenericUserImage.gif"}],
 "things":[{"id":3,
            "description":"Get the team ready",
            "isStarred":false, 
            "status":"InProgress",
            "dateCreated":"2012-03-23T17:40:06.527",
            "owner"{"id":10,
                    "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
                    "emailAddress":"holt@telerik.com"},
            "team":{"name":"A-Team",
                    "id":2,
                    "ownerId":10,
                    "administrators":[2,4],
                    "isPublic":false,
                    "imagePath":"/images/GenericUserImage.gif"},
            "assignedTo":[]}],
 "pendingTeamMembers":[{"id":2,
                        "emailAddress":"tes@demo.com",
                        "fullName":"test test",
                        "role":"Viewer", 
                        "imagePath":"/images/GenericUserImage.gif"}],
 "isPublic":false,
 "owner":{"id":10,
          "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
          "emailAddress":"holt@telerik.com"},
 "administrators":[2,4]}

Get All Things for a Team

Get all things for a given teamId. Status is optional, if status is provided the call will return all team things with the specified status. If status is omitted, the method returns all things with status of InProgress or Delayed.

End point
GET api/team/{teamId}/things/{status|(Optional)}
Default Example
Completed Example

Valid Statuses
InProgress
Delayed
Deleted
Completed

Request Parameters
None

Response
Returns an array of things

[{"id":54,
  "description": "Implement new login system",
  "isStarred":false,
  "status":"Delayed"},
 {"id":56,
  "description":"Research new methods for success",
  "isStarred":false,
  "status":"InProgress"}]

Get All Members on a Team

Get all team members for a given teamId. Status is optional, if status is provided the call will return all team members with the specified status. If status is omitted, the method returns all team members with status of Approved.

End point
GET api/team/{teamId}/members/{status|(Optional)}
Default Example
Completed Example

Valid Statuses
Approved
Denied
Pending

Request Parameters
None

Response
Returns an array of things

[{"id":10,
  "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
  "emailAddress":"holt@telerik.com"},    
 {"id":16,
  "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
  "emailAddress":"anglin@telerik.com"}]

Get Stats for a Team

Get all stats for the team members on a team with the given teamId. Stats are currently just a count of total completed items by team member.

End point
GET api/team/{teamId}/stats
Default Example

Request Parameters
None

Response
Returns an array of team member stats

[{"user":{"id":11,
          "imagePath":"https://lh6.googleusercontent.com/-ZE3J3PaJ9hY/AAAAAAAAAAI/AAAAAAAAABM/pjdMLXkiz2g/photo.jpg",
          "emailAddress":"jholt456@gmail.com"},
  "thingCount":3}]

Create a Team

Create a new team in the team thing application.

End point
POST api/team

Request Parameters
* = Required
*createdById: int ex: 6 (usually current userId)
*name: string ex: "New Team"
isPublic: bool ex: true

Example Request

{"name":"asdf",
 "ispublic":true,
 "createdById":6}

Response
Returns the created team

{"name":"asdf",
 "id":245,
 "ownerId":6,
 "administrators":[6],
 "isPublic":true,
 "imagePath":"/images/GenericUserImage.gif"}

Update a Team

Updates various data about a team. Note now that we have end points for getting members and things, we can probably shorten this response significantly

End point
PUT api/team/{teamId}

Request Parameters
* = Required
*updatedbyid: int ex: 6 (usually current userId)
*name: string ex: "Updated Team"
isPublic: bool ex: true

Example Request

{"name":"Test Team2",
 "ispublic":true,
 "updatedbyid":6}

Response
Returns the updated team

{"name":"Test Team2",
 "id":2,
 "teamMembers":[{"id":4,
                 "emailAddress":"test3@demo.com",
                 "fullName":"test test",
                 "role":"Viewer", 
                 "imagePath":"/images/GenericUserImage.gif"}],
 "things":[{"id":3,
            "description":"Get the team ready",
            "isStarred":false, 
            "status":"InProgress",
            "dateCreated":"2012-03-23T17:40:06.527",
            "owner"{"id":10,
                    "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
                    "emailAddress":"holt@telerik.com"},
            "team":{"name":"Test Team 2",
                    "id":2,
                    "ownerId":10,
                    "administrators":[2,4],
                    "isPublic":false,
                    "imagePath":"/images/GenericUserImage.gif"},
            "assignedTo":[]}],
 "pendingTeamMembers":[{"id":2,
                        "emailAddress":"tes@demo.com",
                        "fullName":"test test",
                        "role":"Viewer", 
                        "imagePath":"/images/GenericUserImage.gif"}],
 "isPublic":true,
 "owner":{"id":10,
          "imagePath":"http://teamthing.apphb.com:16167/images/GenericUserImage.gif",
          "emailAddress":"holt@telerik.com"},
 "administrators":[2,4]}

Invite a User to a Team

Invites a user to a team, if the user does not already exist in the system, a new user will be created. If the team is private and the user that invites a the new member is an admin for the team, the user will be automatically approved. If the user inviting a new member is not an admin, the new member will be pending.

End point
PUT api/team/{teamId}/addmember

Request Parameters
* = Required
*emailaddress: string *addedByUserId: int (usually the current user)

Example Request

  {"addedByUserId":7, 
   "emailAddress": "holt@telerik.com"}

Response
Returns the team the user was added to

{"name":"A-Team",
  "id":2,
  "ownerId":10,
  "administrators":[11],
  "isPublic":false,
  "imagePath":"/images/GenericUserImage.gif"}

Join a Team

Adds a user to a team. If the team is public, the user will be automatically approved, and added to the team. This is end point is used when a user wants to add themselves to a team.

End point
PUT api/team/{teamId}/join

Request Parameters
* = Required
*userId: int (the id of the current user)

Example Request

  {"userId":7}

Response
Returns the team the user joined

{"name":"A-Team",
  "id":2,
  "ownerId":10,
  "administrators":[11],
  "isPublic":false,
  "imagePath":"/images/GenericUserImage.gif"}

Leave a Team

Removes a user from a team they are on. This is end point is used when a user wants to remove themselves from a team.

End point
PUT api/team/{teamId}/leave

Request Parameters
* = Required
*userId: int (the id of the current user)

Example Request

  {"userId":7}

Response
Returns the team the user left

{"name":"A-Team",
  "id":2,
  "ownerId":10,
  "administrators":[11],
  "isPublic":false,
  "imagePath":"/images/GenericUserImage.gif"}

Approve a Pending Team Member

Approves a team member that is currently pending in a non-public team

End point
PUT api/team/{teamId}/approvemember

Request Parameters
* = Required
*userId: int (the id of the pending user)

Example Request

  { "userId": 12, statusChangedByUserId: 10 }

Response
200 Indicates Success

Deny a Pending Team Member

Denies a pending team member in a non-public team

End point
PUT api/team/{teamId}/denymember

Request Parameters
* = Required
*userId: int (the id of the pending user)

Example Request

{ "userId": 12, statusChangedByUserId: 10 }

Response
200 Indicates Success

Delete a Team

Deletes the team with the specified teamId from the team thing application.

End point
DELETE api/team/{teamId}

Request Parameters
* = Required
*userId: int

Example Request

{"userId":6}

Response
204 Indicates Success