A Swift interface to the Harvest time tracking API
See the Harvest API V2 Documentation to learn how the Harvest REST API is structured.
Harvester is distributed as a Swift package. The repository URL is https://github.com/tin-whistle/Harvester.git
Authentication is done using either the OAuth 2 standard or a Personal Access Token. Requests to the Harvest API must include an access token from one of these sources. The Harvester example project uses the Personal Access Token scheme, but you may choose to use an OAuth library or write your own implementation. The only requirement is that your implementation must conform to the AuthorizationProvider protocol which supports authorization, deauthorization, and provides an access token.
Any app which wishes to use OAuth with the Harvest API must first be registered with Harvest (requires a Harvest account).
- Once logged in, chose Create New OAuth2 Application.
- Fill in the app Name.
- Fill in the Redirect URL.
- Harvest API only supports standard HTTP or HTTPS redirect URLs. Therefore, your app must support Universal Links using an associated domain.
- Set Multi Account to I need access to one account.
- Set Products to I want access to Harvest.
- Choose Create Application.
- Use the Client ID and Client Secret values generated on this page with your OAuth library or custom implementation.
Personal access tokens can be generated on the Harvest developers web page. (requires a Harvest account).
- Once logged in, chose Create New Personal Access Token.
- Fill in the access token Name.
- Choose Create Personal Access Token.
- Use the Your Token value generated on this page to authorize all requests to the Harvest API. This will only work for requests to your own account.
HarvestAPI is the main point of contact with the Harvester library. It is initialized with a HarvestAPIConfiguration containing the following properties:
- 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.
- 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.
- authorizationProvider - Your AuthorizationProvider implementation (see Authentication section above).