Get a list of tasks

URL: GET /api/v1/tasks[?code=<task_code>]

Content: None

Returns: A list of Tasks filtered by task_code, if supplied.

Get a task by ID

URL: GET /api/v1/tasks/<task_id>

Content: None

Returns: A single Task whose ID is task_id.

Create a task

URL: POST /api/v1/tasks

Content: The Task to create.

Returns: The Task created.

Update a task

URL: PUT /api/v1/tasks

Content: The Task to update.

Returns: The Task updated.

Delete a task by ID

URL: DELETE /api/v1/tasks/<task_id>

Content: None

Returns: None

Example Code

public string ReadFirstTaskDescription(string accessToken)
{

    string task = string.Empty;

    // Create web request to call API (be sure to add access token to request header)
    var webRequest = (HttpWebRequest) WebRequest.Create(@"https://app.snapschedule365.com/api/v1/tasks");
    webRequest.Method = "GET";
    webRequest.Accept = @"application/json";

    webRequest.Headers.Add("Authorization", "Bearer " + accessToken);
    webRequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

    try
    {
        using (WebResponse webResponse = webRequest.GetResponse())
        {
            // If the web response is OK, then read the reply and extract the first task's description
            if (( (HttpWebResponse) webResponse).StatusCode == HttpStatusCode.OK)
            {
                var reader = new StreamReader(webResponse.GetResponseStream());
                dynamic taskArray = JsonConvert.DeserializeObject<dynamic>(reader.ReadToEnd());

                // If the returned array contains more than one task, extract the first task's description.
                if (taskArray.Count > 0)
                {
                    task = taskArray[0].Description;
                }

                reader.Close();
            }
        }
    }
    catch (WebException e)
    {
        // An error occurred in the call -- handle appropriately
        Console.WriteLine(e);
    }

    return task;

}
function getFirstTaskDescription(accessToken, callback)
{
	// URL of API to invoke
	var serviceUrl = "https://app.snapschedule365.com/api/v1/tasks";

	// Create the request
	var request = new XMLHttpRequest();

	// Build the request
	request.open("GET", serviceUrl, true);
	request.setRequestHeader("accept", "application/json");
	
	// Add access token to request
	request.setRequestHeader("Authorization", "Bearer " + accessToken);  

	// Set up request status handler to invoke the callback function when complete
	request.onreadystatechange = function()
	{
		if (request.readyState == 4)
		{
			if (request.status == 200)
			{
				var taskArray = JSON.parse(request.responseText);

				// If the returned array contains more than one task, extract the first task's description
				if (taskArray.length > 0)
				{
					callback(taskArray[0].Description);
				}
				else
				{
					callback(null);
				}
			}
			else
			{
				alert("HTTP status: " + request.status + "\n" + request.responseText);
			}
		}
	}

	// Send the request
	request.send();
}