Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4569736
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:15:43+00:00 2026-05-21T19:15:43+00:00

Harvest is the time tracking application that I use at my job. While the

  • 0

Harvest is the time tracking application that I use at my job. While the web UI is quite simple, there are a few custom features I would like to add. I noticed they have an API… So I want to make a custom desktop client in C# for it.

Just looking at the page, its not very informative. The C# sample that you can find (after doing some digging) doesn’t help much either. So… How in the world do I use the API with C#?

Link to API page

Any help would be greatly appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:15:44+00:00Added an answer on May 21, 2026 at 7:15 pm

    Harvest is using a REST API, so what is does is you do a get/put/post request to a web address on the server and it will return a result (usually formatted in XML or JSON (appears to be XML in this case)). A quick Google search returned this tutorial on how to use a REST API, hopefully that will be enough for what you need. If not, feel free to ask us about specific problems you are having using REST and C#

    Here I will try to add some more comments to their sample:

    using System;
    using System.Net;
    using System.IO;
    using System.Text;
    using System.Security.Cryptography.X509Certificates;
    using System.Net.Security;
    
    class HarvestSample
    {
        //This is used to validate the certificate the server gives you,
        //it allays assumes the cert is valid.
        public static bool Validator (object sender, X509Certificate certificate,
            X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            return true;
        }
    
        static void Main(string[] args)
        {
            //setting up the initial request.
            HttpWebRequest request;
            HttpWebResponse response = null;
            StreamReader reader;
            StringBuilder sbSource;
            //1. Set some variables specific to your account.
            //This is the URL that you will be doing your REST call against.
            //Think of it as a function in normal library.
            string uri = "https://yoursubdomain.harvestapp.com/projects";
            string username="youremail@somewhere.com";
            string password="yourharvestpassword";
            string usernamePassword = username + ":" + password;
    
            //This checks the SSL cert that the server will give us,
            //the function is above this one.
            ServicePointManager.ServerCertificateValidationCallback = Validator;
    
            try
            {
                //more setup of the connection
                request = WebRequest.Create(uri) as HttpWebRequest;
                request.MaximumAutomaticRedirections = 1;
                request.AllowAutoRedirect = true;
    
                //2. It's important that both the Accept and ContentType headers
                //are set in order for this to be interpreted as an API request.
                request.Accept = "application/xml";
                request.ContentType = "application/xml";
                request.UserAgent = "harvest_api_sample.cs";
                //3. Add the Basic Authentication header with username/password string.
                request.Headers.Add("Authorization", "Basic " + Convert.
                    ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
                //actually perform the GET request
                using (response = request.GetResponse() as HttpWebResponse)
                {
                    //Parse out the XML it returned.
                    if (request.HaveResponse == true && response != null)
                    {
                        reader = new StreamReader(response.GetResponseStream(),
                            Encoding.UTF8);
                        sbSource = new StringBuilder(reader.ReadToEnd());
                        //4. Print out the XML of all projects for this account.
                        Console.WriteLine(sbSource.ToString());
                    }
                }
            }
            catch (WebException wex)
            {
                if (wex.Response != null)
                {
                    using (HttpWebResponse errorResponse = (HttpWebResponse)wex.Response)
                    {
                        Console.WriteLine(
                        "The server returned '{0}' with the status code {1} ({2:d}).",
                        errorResponse.StatusDescription, errorResponse.StatusCode,
                        errorResponse.StatusCode);
                    }
                }
                else
                {
                    Console.WriteLine( wex);
                }
            }
            finally
            {
                if (response != null) { response.Close(); }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django-based web application that is required to send a confirmation email
I am having the hardest time trying to figure out this (should be) simple
I am having the hardest time finding urls to use in Scala Designer 5
Are there any best practices in writing unit tests when 90% of the time
I am looking for a library that, ideally, has the following features: implements hierarchical
I have a live wallpaper that crashes from time to time, and I would
I am having the hardest time to get a simple sendmail.php to work. My
Hey bloggers out there! I've created Wordpress blog that I am hosting myself, and
I'm having the hardest time with what should be super simple. I can't grab
I'm new to MongoDB and as an exercise I'm building an application that extracts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.