How to use Site API?

Sites are one of the cornerstones in WOW's structure. They are the containers for observations, governed by owner users. Using the site's dashboard, you can see the site's historical observation submissions, put them in a graph and compare with another site.

With this API, you can see the details of a site or you can create your own.

For site object schema details, you can check our Site Object Schema article.

Search Sites

To search sites based on its name, Id or location, you can use this API.

Endpoint: Search

Sample request to search sites that has word "site" in their name:

private static async Task<dynamic> SearchSites(string subscriptionKey)
{
    using (var httpClient = new HttpClient())
    {
        httpClient.BaseAddress = new Uri("https://mowowprod.azure-api.net");
        httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);

        using (var response = await httpClient.GetAsync("/api/sites/search?text=site"))
        {
            response.EnsureSuccessStatusCode();
            return JArray.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response:

[
  {
    "id": "687906048",
    "name": "Kingston - Cades Dr Site 2 - TAS",
    "description": "Manual rain gauge",
    "longitude": 147.265166,
    "latitude": -42.969123
  },
  {
    "id": "69044776",
    "name": "OPAL - Manchester University Firs Experimental Site",
    "description": "An Automatic Weather Station OPAL (Open Air Laboratories) site installed on 11/04/2011.",
    "longitude": -2.21211,
    "latitude": 53.4437
  }
]

Query Site Details

To get site metadata details, you can use this API.

Endpoint: GetObservationSite

Getting details of site 687906048:

private static async Task<dynamic> GetSiteDetail(string subscriptionKey)
{
    using (var httpClient = new HttpClient())
    {
        httpClient.BaseAddress = new Uri("https://mowowprod.azure-api.net");
        httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);

        using (var response = await httpClient.GetAsync("/api/sites/ObservationSite?id=687906048"))
        {
            response.EnsureSuccessStatusCode();
            return JObject.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response:

{
  "id": "687906048",
  "siteName": "Cades-2 Kingston Tasmania",
  "groupId": null,
  "groupName": null,
  "groupTypeName": null,
  "groupImageUrl": null,
  "belongsToBrand": "aubom",
  "hasGroup": false,
  "isSchool": false,
  "isOfficial": false,
  "metOfficeId": "",
  "location": {
    "geography": {
      "coordinateSystemId": 4326,
      "wellKnownText": "POINT (147.265166 -42.969123 192)"
    }
  },
  "siteLogoImagePath": null,
  "northSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206006/689206006.jpg",
  "eastSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206005/689206005.jpg",
  "southSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206007/689206007.jpg",
  "westSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206004/689206004.jpg",
  "siteRating": 2,
  "description": "Manual rain gauge. Nylex model MS102 'Marquis 1000' Professional. http://www.cyclone.com.au/products/rain-gauges-2/nylex-rain-gauge-1000",
  "isActive": true,
  "reason": "Hobbyist",
  "timeZone": "Tasmania Standard Time",
  "locationExposureAttrib": "1",
  "temperatureAttrib": "D",
  "rainfallAttrib": "C",
  "windAttrib": "C",
  "urbanClimateZoneAttrib": "7",
  "reportingHoursAttrib": "B",
  "website": "http://www.allskycam.com/u.php?u=539",
  "otherReason": "",
  "equipmentType": 0,
  "defaultGraphFields": null,
  "defaultTableFields": null,
  "isDcnn": false,
  "hasEditPermission": false,
  "hasViewHolidaysPermission": false,
  "hasManageUsersPermission": false,
  "latestBadge": null,
  "isReported": false,
  "ownerId": "53285",
  "lastObservationDate": "2014-04-23T12:00:00Z"
}

Query Site Details (Alternative)

This is an alternative to site details endpoint, just returns in a different structure.

Endpoint: GetSite

Getting details of site 687906048:

private static async Task<dynamic> GetSiteDetailAlternative(string subscriptionKey)
{
    using (var httpClient = new HttpClient())
    {
        httpClient.BaseAddress = new Uri("https://mowowprod.azure-api.net");
        httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);

        using (var response = await httpClient.GetAsync("/api/sites/687906048"))
        {
            response.EnsureSuccessStatusCode();
            return JObject.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response:

{
  "additionalInformation": "Rain gauge manually read to 0.1 mm at 0900 local time daily. Trace observations entered as 0.05 mm. Missing days not entered, but accumulation over missing days given at first available day after missing days.",
  "adjustForDaylingSavings": false,
  "airTemperature": 0,
  "allowDownload": true,
  "authenticationKey": "314159",
  "concreteTemp": 0,
  "dayOfGales": 0,
  "dayOfHail": 0,
  "dayOfSnow": 1,
  "dayOfThunder": 0,
  "description": "Manual rain gauge. Nylex model MS102 'Marquis 1000' Professional. http://www.cyclone.com.au/products/rain-gauges-2/nylex-rain-gauge-1000",
  "dewPoint": 0,
  "eastSideImageId": "689206005",
  "eastSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206005/689206005.jpg",
  "equipmentType": 0,
  "exposure": "1",
  "grassTemp": 0,
  "groundState": 0,
  "groupId": null,
  "heightAboveSeaLevel": 192,
  "id": "687906048",
  "isActive": true,
  "isPublic": true,
  "isSiteOwner": false,
  "latitude": -42.969123,
  "longitude": 147.265166,
  "maxTempLast24h": 0,
  "meanSeaLevelPressure": 0,
  "minTempLast24h": 0,
  "mobileSiteType": null,
  "name": "Cades-2 Kingston Tasmania",
  "northSideImageId": "689206006",
  "northSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206006/689206006.jpg",
  "organisation": "",
  "otherReason": "",
  "presentWeather": 0,
  "pressureAtStation": 0,
  "rainfall": "C",
  "rainfallAccumulation": 1,
  "rainfallRate": 0,
  "reason": "Hobbyist",
  "relativeHumidity": 0,
  "reportingHours": "B",
  "siteLogoImageId": null,
  "siteLogoImagePath": null,
  "siteOwnerUserId": "53285",
  "snowDepth": 0,
  "soilMoisture": 0,
  "soilTemp100cm": 0,
  "soilTemp10cm": 0,
  "soilTemp30cm": 0,
  "southSideImageId": "689206007",
  "southSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206007/689206007.jpg",
  "sunshine": 0,
  "temperature": "D",
  "timeZone": "Tasmania Standard Time",
  "totalCloudCover": 0,
  "urbanClimateZone": "7",
  "visibility": 0,
  "webSite": "http://www.allskycam.com/u.php?u=539",
  "westSideImageId": "689206004",
  "westSideImagePath": "https://mowowprod.blob.core.windows.net/images/689206004/689206004.jpg",
  "wetBulb": 0,
  "wind": "C",
  "windDirection": 0,
  "windGust": 0,
  "windGustDirection": 0,
  "windSpeed": 0,
  "siteRowVersion": "AAAAAAA6Zac=",
  "isOfficial": null,
  "isDcnn": false,
  "adminUserIds": null,
  "lastModifiedOn": null,
  "lastObservationDate": "2014-04-23T12:00:00Z",
  "dataMeasurements": [
    {
      "name": "DayOfSnow",
      "value": 1
    },
    {
      "name": "RainfallAmount",
      "value": 1
    }
  ]
}

Post a New Site

To create a new site, you can use this endpoint.

Endpoint: PostSite

Creating a new site:

private static async Task<dynamic> CreateSite(string subscriptionKey, string accessToken)
{
    using (var httpClient = new HttpClient())
    {
        httpClient.BaseAddress = new Uri("https://mowowprod.azure-api.net");
        httpClient.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
        httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);

        var site = new
        {
            name = "My WOW Site",
            authenticationKey = 123123,
            airTemperature = "Celsius",
            rainfallRate = "Captured",
            latitude = 51.5072,
            longitude = -0.1275,
            isPublic = true
        };

        using (var response = await httpClient.PostAsync("/api/sites", new StringContent(JsonConvert.SerializeObject(site), Encoding.UTF8, "application/json")))
        {
            response.EnsureSuccessStatusCode();
            return JObject.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response:

{
  "additionalInformation": null,
  "adjustForDaylingSavings": false,
  "airTemperature": 2,
  "allowDownload": false,
  "authenticationKey": "123123",
  "concreteTemp": 0,
  "dayOfGales": 0,
  "dayOfHail": 0,
  "dayOfSnow": 0,
  "dayOfThunder": 0,
  "description": null,
  "dewPoint": 0,
  "eastSideImageId": null,
  "eastSideImagePath": null,
  "equipmentType": 0,
  "exposure": null,
  "grassTemp": 0,
  "groundState": 0,
  "groupId": null,
  "heightAboveSeaLevel": null,
  "id": "39dd1d13-75c7-e611-9cf0-303a64e807ff",
  "isActive": false,
  "isPublic": false,
  "isSiteOwner": false,
  "latitude": 51.5072,
  "longitude": -0.1275,
  "maxTempLast24h": 0,
  "meanSeaLevelPressure": 0,
  "minTempLast24h": 0,
  "mobileSiteType": null,
  "name": "My WOW Site",
  "northSideImageId": null,
  "northSideImagePath": null,
  "organisation": null,
  "otherReason": null,
  "presentWeather": 0,
  "pressureAtStation": 0,
  "rainfall": null,
  "rainfallAccumulation": 0,
  "rainfallRate": 1,
  "reason": null,
  "relativeHumidity": 0,
  "reportingHours": null,
  "siteLogoImageId": null,
  "siteLogoImagePath": null,
  "siteOwnerUserId": null,
  "snowDepth": 0,
  "soilMoisture": 0,
  "soilTemp100cm": 0,
  "soilTemp10cm": 0,
  "soilTemp30cm": 0,
  "southSideImageId": null,
  "southSideImagePath": null,
  "sunshine": 0,
  "temperature": null,
  "timeZone": null,
  "totalCloudCover": 0,
  "urbanClimateZone": null,
  "visibility": 0,
  "webSite": null,
  "westSideImageId": null,
  "westSideImagePath": null,
  "wetBulb": 0,
  "wind": null,
  "windDirection": 0,
  "windGust": 0,
  "windGustDirection": 0,
  "windSpeed": 0,
  "currentUser": null
}