Skip to content
Richard Thombs edited this page Jan 11, 2015 · 23 revisions

The Users API provides access to the User Management functionality of TeamHaven.

Get an existing user

GET /api/users/:u[?schema=true]

Gets the specified user. If schema=true is present, then the User's Attribute Schema is included in the response.

Update an existing user

PUT /api/users/:u

Create a new user

POST /api/users

Delete an existing user

DELETE /api/users/:u

User search

GET /api/users

Returns an array of Users that match the specified search criteria.

Query String parameters

User.Username

Only return Users whose Username matches the specified value. * can be used as a wildcard.

User.DisplayName

Only return Users whose DisplayName matches the specified value. * can be used as a wildcard.

User.Role

Only return Users with the specified Role.

UserAttribute.Name

Only return Users whose 'Name' Attribute matches the specified value. * can be used as a wildcard. Eg: UserAttribute.Email=richard@teamhaven.com

LowestRole

Only return Users with the specified Role or a higher one.

HighestRole

Only return Users with the specified Role or a lower one.

Collector

Only return Users who can collect Calls.

ProjectID

Only return Users who have access to the specified Project ID. Collectors have access if they have been assigned to any Calls or Targets. Project Managers, Field Managers and Clients must be explicitly given access. Administrators always have access.

Role values are:

1 - Administrator
2 - Collector
3 - Project Manager
4 - Client
5 - Field Manager

Find users closest to the specified position

GET /api/users/closest?position=:latlng&radius:r[&incumbent=:u]

Returns an array of up to 5 Collectors who are the closest to the specified position.

Query String parameters

position

The latitude and longitude centre of the search area. Must be specified as a pair of floating point numbers using ',' as a separator and '.' as the decimal point. Eg: 12.4323,-23.213.

radius

The search radius, specified in miles.

incumbent

The UserID of a User who should always be included in the list of results, even if they do not meet the search criteria.

Clone this wiki locally