Created
January 18, 2014 15:07
-
-
Save vgirard/8491738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User | |
{ | |
public int Id { get; set; } | |
public string Email { get; set; } | |
public string FirstName { get; set; } | |
public string first_name { get; set; } | |
public string First_name { get; set; } | |
public string First_Name { get; set; } | |
} | |
public List<User> Users() | |
{ | |
var client = new RestClient(HarvestApiUrl); | |
client.Authenticator = new HttpBasicAuthenticator(HarvestUserName, HarvestPassword); | |
client.UserAgent = "spektrummedia"; | |
var request = new RestRequest("people") | |
{ | |
Method = Method.GET, | |
//Credentials = new NetworkCredential(HarvestUserName, HarvestPassword), | |
RequestFormat = DataFormat.Json, | |
}; | |
/*request.AddUrlSegment("user_id", "298203"); | |
request.AddParameter("from", "20140112"); | |
request.AddParameter("to", "20140119");*/ | |
var response = client.Execute<List<User>>(request); | |
if (response.StatusCode != HttpStatusCode.OK && | |
response.StatusCode != HttpStatusCode.Created) | |
{ | |
throw new Exception(response.ErrorMessage, response.ErrorException); | |
} | |
return response.Data; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"user": | |
{"cost_rate":null, | |
"created_at":"2012-01-17T02:35:33Z", | |
"default_expense_category_id":null, | |
"default_expense_project_id":null, | |
"default_hourly_rate":70.0, | |
"default_task_id":null, | |
"default_time_project_id":null, | |
"department":"Dev", | |
"email":"aleclair@spektrummedia.com", | |
"first_name":"Antoine", | |
"has_access_to_all_future_projects":true, | |
"id":298202, | |
"identity_url":null, | |
"is_active":true, | |
"is_admin":false, | |
"is_contractor":false, | |
"last_name":"Leclair", | |
"opensocial_identifier":null, | |
"telephone":"", | |
"timezone":"Eastern Time (US & Canada)", | |
"updated_at":"2013-12-23T17:32:41Z", | |
"wants_newsletter":false, | |
"wants_weekly_digest":true, | |
"weekly_digest_sent_on":null} | |
}, | |
{"user":{"cost_rate":null,"created_at":"2012-01-17T02:35:21Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":70.0,"default_task_id":null,"default_time_project_id":null,"department":"","email":"atheriault@spektrummedia.com","first_name":"Antoine","has_access_to_all_future_projects":true,"id":298201,"identity_url":null,"is_active":false,"is_admin":false,"is_contractor":false,"last_name":"Theriault","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2012-02-03T23:11:39Z","wants_newsletter":false,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-01-17T02:35:48Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":70.0,"default_task_id":null,"default_time_project_id":null,"department":"Dev","email":"couellet@spektrummedia.com","first_name":"Charles","has_access_to_all_future_projects":true,"id":298203,"identity_url":null,"is_active":true,"is_admin":false,"is_contractor":false,"last_name":"Ouellet","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-16T22:51:39Z","wants_newsletter":false,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-01-06T23:02:32Z","default_expense_category_id":801312,"default_expense_project_id":1881749,"default_hourly_rate":70.0,"default_task_id":1186144,"default_time_project_id":1881749,"department":"Gestion","email":"gsaad@spektrummedia.com","first_name":"Georges","has_access_to_all_future_projects":true,"id":293591,"identity_url":null,"is_active":true,"is_admin":true,"is_contractor":false,"last_name":"Saad","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-16T22:51:39Z","wants_newsletter":true,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2013-04-26T19:50:43Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":80.0,"default_task_id":null,"default_time_project_id":null,"department":"Dev","email":"gcoguiec@spektrummedia.com","first_name":"Guillaume","has_access_to_all_future_projects":true,"id":506760,"identity_url":null,"is_active":true,"is_admin":false,"is_contractor":false,"last_name":"Coguiec","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-16T22:51:39Z","wants_newsletter":true,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2013-01-21T13:56:14Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":null,"default_task_id":null,"default_time_project_id":null,"department":"Dev","email":"jdgauvin@spektrummedia.com","first_name":"Jean-Daniel","has_access_to_all_future_projects":true,"id":452802,"identity_url":null,"is_active":true,"is_admin":false,"is_contractor":false,"last_name":"Gauvin","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-17T16:37:03Z","wants_newsletter":true,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-01-06T22:49:34Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":70.0,"default_task_id":null,"default_time_project_id":null,"department":"Design","email":"jsimard@spektrummedia.com","first_name":"Jonathan","has_access_to_all_future_projects":true,"id":293583,"identity_url":null,"is_active":true,"is_admin":true,"is_contractor":false,"last_name":"Simard","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-16T22:51:39Z","wants_newsletter":true,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-01-17T02:35:06Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":70.0,"default_task_id":null,"default_time_project_id":null,"department":"Int\u00e9gration","email":"mebacher@spektrummedia.com","first_name":"Mathieu","has_access_to_all_future_projects":true,"id":298200,"identity_url":null,"is_active":true,"is_admin":true,"is_contractor":false,"last_name":"Ebacher","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-17T16:14:25Z","wants_newsletter":false,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-03-23T20:57:05Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":80.0,"default_task_id":null,"default_time_project_id":null,"department":"Int\u00e9gration","email":"sroy@spektrummedia.com","first_name":"Stephanie","has_access_to_all_future_projects":true,"id":326079,"identity_url":null,"is_active":true,"is_admin":false,"is_contractor":false,"last_name":"Roy","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-17T21:55:25Z","wants_newsletter":false,"wants_weekly_digest":true,"weekly_digest_sent_on":null}},{"user":{"cost_rate":null,"created_at":"2012-01-17T02:36:01Z","default_expense_category_id":null,"default_expense_project_id":null,"default_hourly_rate":70.0,"default_task_id":null,"default_time_project_id":null,"department":"Dev","email":"vgirard@spektrummedia.com","first_name":"Vincent","has_access_to_all_future_projects":true,"id":298204,"identity_url":null,"is_active":true,"is_admin":true,"is_contractor":false,"last_name":"Girard","opensocial_identifier":null,"telephone":"","timezone":"Eastern Time (US & Canada)","updated_at":"2014-01-18T14:05:47Z","wants_newsletter":false,"wants_weekly_digest":true,"weekly_digest_sent_on":null}}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment