7eggs/node-toggl-api

V8 API is deprecated and will be phased out soon, should change to v9 endpoints.

LiamKarlMitchell opened this issue · 11 comments

The V8 API is deprecated and will be phased out soon, more info about this here https://toggl.com/blog/toggl-track-api-v9
It should be updated to V9 endpoints.

We’re phasing out v8 within the next six months.
Last Updated: 12 April 202202 September 2022

So it's probably going to break everything soon just letting you know.

rzfzr commented

Nice catch, I'll will be taking a look at it over the weekend

This came from an email with them about the duronly field when calling /api/v8/time_entries.
It is deprecated and always true, alternatively can just check if the end date is null.

"You can indeed check for the end date being null instead of relying on the deprecated duronly field."

rzfzr commented

Ok, so following the docs v8 endpoints will be disabled on April 1st.

I've replaced the endpoints here, @LiamKarlMitchell can you give it a go? I don't have a running project that uses this module at the moment....

The docs mention some other work may be needed besides changing the endpoints, so I'm afraid it is not fully functional.

Ok, so just coming back to this, the endpoint migration is not as straightforward as I thought, but they do have a guide, I'm implementing it here for now.

Todo list before the next release:

  • Replace all v8 endpoints
  • Test all endpoints (I will need a volunteer for the paid features)
  • Document all breaking changes
  • Ideally implement all the new endpoints
  • Update all original documentation links for each call

I also found something that didn't make sense to me on their migration guide (although I don't use projects):
GET /projects/{project_id}/project_users Becomes => /workspaces/{workspace_id}/project_users
getting the users on the new API should prob be workspace AND project specific, since "projects" are not deprecated.

I have decided to organize the modules in the same abstraction as the API reference

  • Me
  • Preferences
  • Authentication
  • Time entries
  • Organizations
  • Invitations
  • Groups
  • Workspaces
  • Clients
  • Projects
  • Tasks
  • Tags
  • Approvals

@rzfzr thanks for this library, is it possilbe that you publish the beta version with v9 on npm?

It is published already :)
Just install it with package@beta

It is published already :) Just install it with package@beta

I was searching it in the releases tab on GitHub and did not find it 🙈

My bad, i did not update the release tabs as I published it only for testing on my own app.
I'll look into automating the release process

checkSummaryGrouping is not defined is thrown when I want to get a summaryReport

client.summaryReport(
      { workspace_id, start_date, end_date },
      (err, report) => {
        if (err) {
          reject(err);
        } else {
          resolve(report);
        }
      }
    );

The checklist above is updated, clients hasn't migrated completely yet, will check it out soon.

Edit. I just saw that 1. reports are served from a different endpoint and 2. toggl now provides a swagger config, so I don't think I'll be implementing this soon, rather I will look into generating the rest of the client.
@appinteractive In the meantime, if you feel like implementing just what you need from this, I can merge and publish that for you.