Harvest API Documentation

Commands

All requests need to contain the output_type parameter, this should be set to application/json for now.

All requests need to contain the api_key parameter, this should be set to your API key, if you don't have one please contact Harvest Support.

The Harvest API is not intended to be used from within client side script such as Javascript as this will open up your API key for others to view, as such we have not added headers to allow CORS (attempts to do so in browsers such as Chrome will throw an error, typically something like "Access to XMLHttpRequest at URL from origin YourWebServer has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource". The intended usage is for you to implement the requests server side, at this point you will be able to utilise the likes of AJAX to make a call to your own server which will then access the Harvest API.

Your requests may result in errors if you fail to include required parameters (these will be noted by the command type and the required column). You may also see errors if you fail to adhere to the rate limits

Get User Site List

Command Type

get_user_site_list

Request Type

GET

Output Types Supported

application/json

Details

Returns JSON object containing an array of site objects for sites that the given API Key or User Name & Password has specific access to.

By default the site object will contain a 'site_options' object with an array of 'locations' for the site. Setting the optional parameter 'include_all_options=1' will return the other options related to each site.

Get Data

Command Type

Request Type

Output Types Supported

Details

If the start_time parameter is omitted then the system will return the latest log. If you wish to retrieve the latest data for a number of traces, consider using the Get Latest Data command instead

If the start_time parameter is set then it will return up to 100 logs from the specified start time. In the scenario more than 100 logs are available a "next" link will be provided for use in obtaining the next set of logs, this will be provided until there are no longer more than 100 logs. It is advisable to use the "next" link rather than manually adjusting the start parameter.

Example Usage

Response

JSON object containing the latest data for the specified traces. It should not be assumed that all traces are from the same point in time, especially when requesting across multiple sites. Utilise the unix_time parameter in each of the individual trace objects to get the timestamp for each trace id.

Returned timestamps are in UTC, timezone names are added for the purpose of converted data to the sites local time if necessary.

Get Summary Data

Command Type

get_summary_data

Request Type

GET

Output Types Supported

application/json

Details

If the date parameter is specified the 'day' summary data will be for midnight to midnight of the specified date.The date requested should be in the site local timezone.When no date is specified the day summary data will be from midnight of the current day to the time of the request.

When the season parameter is set to 1, seasonal statistics will be included.

If the date parameter is specified the 'season' summary data will be for the relevant season (configured for the site) that falls within the specified date.When no date is specified the season summary data will be for the current season.

Parameters

Parameter

Description

Type

Required

trace_ids

Array of trace ids to get data from (e.g. [1234, 5678, 91011]

Array(Unsigned INT)

TRUE

date

Optional start time (site local timezone) to retrieve date for statistics (Y-m-d+H:i:s)