Allow browser extensions to access a part of the Harvest API safely.
Do a safe query to the time entries API and allow to parse the result in your favorite tool. For instance, Gitlab.
/api/v2/time_entries?external_reference_id=[YOUR_REFERENCE]
Docs: https://help.getharvest.com/api-v2/timesheets-api/timesheets/time-entries/
This project is built with:
- Next.js 14 (App Router)
- Node.js 18+
- Deployed on Vercel
- Install dependencies:
npm install- Copy the environment variables template:
cp .env.example .env- Configure your environment variables in
.env:
HARVEST_TOKEN=your_harvest_token_here
HARVEST_ACCOUNT_ID=your_harvest_account_id_here
HARVEST_API=https://api.harvestapp.com/
ELGENTOS_AUTHORIZATION=Bearer your_secret_token_here
- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
- Install Vercel CLI:
npm i -g vercel- Deploy:
vercel- Set up environment variables in the Vercel dashboard or via CLI:
vercel env add HARVEST_TOKEN
vercel env add HARVEST_ACCOUNT_ID
vercel env add ELGENTOS_AUTHORIZATION- Push your code to a Git repository (GitHub, GitLab, or Bitbucket)
- Go to vercel.com and sign in
- Click "Add New Project"
- Import your repository
- Configure environment variables:
HARVEST_TOKENHARVEST_ACCOUNT_IDHARVEST_API(optional, defaults to https://api.harvestapp.com/)ELGENTOS_AUTHORIZATION(optional, secure your endpoint)
- Click "Deploy"
Get your token from your Harvest account: https://id.getharvest.com/developers
HARVEST_TOKEN- Your Harvest API token (required)HARVEST_ACCOUNT_ID- Your Harvest account ID (required)HARVEST_API- Harvest API base URL (optional, defaults to https://api.harvestapp.com/)ELGENTOS_AUTHORIZATION- Authorization header value to secure your endpoint (optional)
Once deployed, you can access the proxy at:
https://your-deployment.vercel.app/api/v2/time_entries?external_reference_id=YOUR_REFERENCE
If you've set ELGENTOS_AUTHORIZATION, include it in your request headers:
curl -H "Authorization: Bearer your_secret_token_here" \
"https://your-deployment.vercel.app/api/v2/time_entries?external_reference_id=YOUR_REFERENCE"This project has been migrated from a Node.js HTTP server to Next.js App Router for better compatibility with Vercel. The API endpoint path remains the same, so existing integrations should continue to work without changes.
Special shoutout to @woutersteen because I removed the original script from Heroku and needed to recreate this awesomeness again. Cheers Wouter!
Thanks Jeroen. But it's time to move on. We migrated this script from Heroku to Vercel. :)