How to upload observations in bulk?

WOW supports uploading observations in bulk files. You can use the following endpoints to upload in bulk and query your upload job status.

Post Observations in Bulk

To submit observations in bulk to a site, you can use this operation. Files submitted to this endpoint are queued and processed in the background, so this endpoint will only be returning you a tracking number. You can query later to see if your file is processed.

This endpoint supports two file formats: WowCsv (a CSV file) and WeatherLinkTab (a TXT file). Both of their samples can be found on WOW Support section.

Endpoint: UploadBulkFile

Sample request code to submit a WowCsv file to our site:

private static async Task<dynamic> UploadBulkImportFile(string subscriptionKey, string accessToken, string fileName)
{
    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);
        
        using (var response = await httpClient.PostAsync("/api/observations/uploadbulkfile?qqFile=wow.csv&format=WowCsv&siteId=afe3b80f-96f6-e511-9403-0003ff7b4363", new StringContent(File.ReadAllText(fileName), Encoding.UTF8, "application/json")))
        {
            response.EnsureSuccessStatusCode();
            return JObject.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response will be a Json file with two fields: Success (boolean) and FileImportId (Guid). You can use this import id to track its progress.

Query Bulk Status

To submit your bulk import file's tatus and details, you can use this endpoint.

Status: 0: Waiting, 1: Processing, 2: Completed, 3: Failed, 4: Cancelled.

Endpoint: BulkFileStatus

Sample request code to chech a WowCsv file we submitted:

private static async Task<dynamic> GetBulkImportStatus(Guid id, 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);

        using (var response = await httpClient.GetAsync("/api/observations/bulkfilestatus/" + id))
        {
            response.EnsureSuccessStatusCode();
            return JObject.Parse(await response.Content.ReadAsStringAsync());
        }
    }
}

The response:

{
  "status": 0,
  "format": "WowCsv",
  "source": "Website",
  "originalFileName": "wow.csv",
  "blobName": "46fd8282-c5c6-e611-9cf0-303a64e807ff/wow.csv",
  "hash": null,
  "createdDate": "2016-12-20T15:03:49.4498892Z",
  "processingStartDate": null,
  "processingFinishDate": null,
  "additionalProperties": "{\"SiteId\":\"afe3b80f-96f6-e511-9403-0003ff7b4363\"}",
  "userId": null,
  "validationResults": []
}