Skip to content
richardthombs edited this page Feb 20, 2013 · 83 revisions

The Web API is a new REST based interface to key parts of the TeamHaven Server business layer. It is available under the /api URL of TeamHaven servers. Eg:

http://www.teamhaven.com/api
http://dev.teamhaven.com/api
http://beta.teamhaven.com/api

Eventually it will be available via HTTPS as well, but currently it is not.

Authorisation

Authorisation is performed via HTTP Basic authorisation, using Base64 encoded TeamHaven credentials. It is also possible to provide unencoded credentials using "TeamHaven" as the authentication scheme name rather than "Basic".

Authorization: Basic c3RvbnkvdGVzdDp0ZXJyaWVy

or

Authorization: TeamHaven username/account:password

A standard TeamHaven authentication cookie can also be used, so that if web pages on the TeamHaven website wish to use the WebAPI, they may do so without having to take any action, as their requests will already contain the required cookie. This means you can log into TeamHaven and review the output of any GET requests via your web browser, provided it can display XML or JSON output.

Status codes

2xx
Success
4xx
Something was wrong with your request. Check the Message property of the response for more information about what was wrong.
5xx
An exception prevented the server from processing your request, contact support@teamhaven.com for assistance.

Collector API

  • List calls
  • Get a specific call
  • Edit a call
  • Get the questionnaire for a call
  • Get the answers for a call
  • Update the answers for a call
  • List projects
  • Get information about a specific project

Collector API

User management

/api/users

Logging

/api/log

Audit trail

/api/audit

Localisation

/api/localisation

Who am I?

GET /api/user

Gets information about the logged in user.

GET /api/users/schema

Gets the user schema.

Error log

GET /api/log

List all login sessions matching the specified criteria

Query String Parameters

severity
Return only login sessions with an error at least a severe as level N. The lower the severity number, the worse the issue. Levels 0-3 are actual errors, Levels 4-7 are warnings and debug messages.
user
Only return sessions associated with the specified User ID.
GET /api/log/:ticket

List individual log entries for the given login session.

Audit Log

The Audit Log tracks actions that have affected certain TeamHaven objects, providing an audit trail of who has modified them.

GET /api/audit/:type/:id

List actions that modified the specified object.

URL parameters

type
call for the call audit log
id
The TeamHaven ID of the object being audited. Ie, a Call ID when type=call

Checkins

Checkins allow a user to send status updates about a specific call to the server without having to complete the call itself.

POST /api/user/calls/:id/checkins

Send a status update.

URL parameters

id
The Call ID that the user is sending a status update for

Body

{
  Type: 1,
  Date: '2013-02-01T14:49:40.223',
  LatLng: { Lat = 52.5, Lng = 0.2 },
  Message: 'Arrived at store'
}
Type
The type of checkin being posted:
  • 1Arrival
  • 2Departure
  • 3Status update
Date
Optional UTC date and time of the checkin.
LatLng
An optional object giving the latitude and longitude of the user's current position.
Message
An optional message
GET /api/calls/:id/checkins

List the checkins posted for specific call.

Localisation

GET /api/localisation/text/:culture/:path

Lists the localised text for a set of labels.

URL parameters

culture
An ISO 639-2 language code, eg enfor English, or fr for French
.
path
Further parts of the path allow a subset of labels to be returned, eg /api/localisation/text/en/CallStatus will return the English translations of all labels beginning with /CallStatus.

Query String Parameters

platform
An optional platform identifier that filters the results to just those flagged as required by the given platform:
  • pocketpcWindows Mobile
  • androidAndroid
  • windows8Windows RT and Windows 8

Clone this wiki locally