Skip to content

Instantly share code, notes, and snippets.

@jacobg
Last active December 17, 2015 22:59
Show Gist options
  • Save jacobg/5686133 to your computer and use it in GitHub Desktop.
Save jacobg/5686133 to your computer and use it in GitHub Desktop.
Fareclock API sample for C#
using System;
using System.Net.Http;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
string token = "{{ MY API KEY }}";
string [] searchParams = {
"from=2013-05-31",
"to=2013-05-31"/*,
"paylocation=0",
"clocklocation=0",
"employee=0",
"department=0",
"status=all",*/
};
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", String.Format("Token {0}", token));
var response = client.GetAsync("https://www.fareclock.com/api/punches/?" + String.Join("&", searchParams));
var responseContent = response.Result.Content;
string result = responseContent.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment