Swiftpack.co - Package - tin-whistle/Harvester


A Swift interface to the Harvest time tracking API

Harvest API

See the Harvest API V2 Documentation to learn how the Harvest REST API is structured.

Using Harvester


Harvester is distributed as a Swift package. The repository URL is https://github.com/tin-whistle/Harvester.git


Authentication is done using the OAuth 2 standard. The Harvester library uses the Authorization Code flow option. The Harvester example project uses the OAuthSwift library, but you may choose to use another library or write your own implementation. The only requirement is that your OAuth library must conform to the OAuthProvider protocol.

Any app which wishes to use the Harvest API must first be registered with Harvest (requires a Harvest account).

  1. Once logged in, chose Create New OAuth2 Application.
  2. Fill in the app Name.
  3. Fill in the Redirect URL.
  4. Set Multi Account to I need access to one account.
  5. Set Products to I want access to Harvest.
  6. Choose Create Application.
  7. Use the Client ID and Client Secret values generated on this page with your OAuth library or custom implementation.


In order for Harvester to make authorized requests to the Harvest API, it must have the proper OAuth credentials. These are provided by the OAuthProvider protocol. This protocol provides essential functions needed to interact with your chosen OAuth library or custom implementation. It allows Harvester to check authorization status, authorize and deauthorize the app, and make generic authorized network requests. The example app contains an implementation for the OAuthSwift library.


HarvestAPI is the main point of contact with the Harvester library. It is initialized with a HarvestAPIConfiguration containing the following properties:

  1. appName - The name of your app. This is sent to Harvest as part of a user agent string. It is used to identify which app a request came from.
  2. contactEmail - The email address which Harvest should use to contact you with questions or comments. This is sent to Harvest as part of a user agent string.
  3. oauthProvider - Your OAuthProvider implementation (see OAuthProvider section above).


Stars: 1
Help us keep the lights on


Used By

Total: 0