jason0x43 / alfred-toggl

Alfred Workflow for interacting with the Toggl time tracking service
MIT License
367 stars 16 forks source link

Update Toggl Track API to v9 #65

Closed jjarava closed 3 months ago

jjarava commented 3 months ago

Hi!

As of this morning, when trying to use the Toggl Tack integration (which I very much love and depend on!) I'm getting Error: 418 I’m a teapot responses.

Checking on the Toggl site, I assume that it's due to the API v8 being phased out.

I've done a quick check and that indeed seems to be the reason for the 418 response:

curl -v -u zzzzzzzzz:api_token https://api.track.toggl.com/api/v8/me
*   Trying 34.120.83.142:443...
* Connected to api.track.toggl.com (34.120.83.142) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=api.track.toggl.com
*  start date: May 14 11:35:59 2024 GMT
*  expire date: Aug 12 12:29:53 2024 GMT
*  subjectAltName: host "api.track.toggl.com" matched cert's "api.track.toggl.com"
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1D4
*  SSL certificate verify ok.
* using HTTP/2
* Server auth using Basic with user 'xxxxxxxxxxx'
* [HTTP/2] [1] OPENED stream for https://api.track.toggl.com/api/v8/me
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: api.track.toggl.com]
* [HTTP/2] [1] [:path: /api/v8/me]
* [HTTP/2] [1] [authorization: Basic xxxxxxxxxxxxxxx]
* [HTTP/2] [1] [user-agent: curl/8.4.0]
* [HTTP/2] [1] [accept: */*]
> GET /api/v8/me HTTP/2
> Host: api.track.toggl.com
> Authorization: Basic xxxxxxxxxxxxxx
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/2 418
< server: nginx
< date: Wed, 15 May 2024 11:08:06 GMT
< content-type: text/plain; charset=utf-8
< content-length: 194
< cache-control: no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0
< x-toggl-request-id: 0f78196a-980a-4f7d-b1e0-85745d7e9816
< instance: track-public-api-proxy-68c8f5bc4-p2xq2
< strict-transport-security: max-age=15552000; includeSubDomains
< x-frame-options: SAMEORIGIN
< x-content-type-options: nosniff
< x-we-are-hiring: https://toggl.com/jobs/
< x-request-id: 8496345c2f49281be1270a48a14930e8
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
<
* Connection #0 to host api.track.toggl.com left intact
"The V8 endpoint is scheduled to be shutdown on 23/05/2024, this is a brownout. Please find the migration guide at https://engineering.toggl.com/changes/2022/10/01/api-v8-deprecation/index.html"%

Any chances that the integration would be updated to v9 API? Thanks!

s7anley commented 3 months ago

Hey 👋 to prevent multiple people from working on the rewrite simultaneously, I started migrating go-toggl this week. There will be some BC in the go-toggl package, but adapting it should not be much work.

Hopefully, I will manage before 23.5 😅 🤞

jjarava commented 3 months ago

Hi @s7anley First of all, thanks for looking into this; Alfred-toggl is something I use daily dozens of times!!... but being completely ignorant of Go, I'm a bit stumped... I've tried to take a stab at updating the API with the help of ChatGPT (see here my conversation), and the result of the updates done on the "main.go" file can be found here (or as a Pull Request, here).

Anyhow, happy to help in some other way (e.g. testing the result!). Thanks!

/cc @jason0x43

s7anley commented 3 months ago

Hey 👋 There is a draft PR already prepared https://github.com/jason0x43/alfred-toggl/pull/66 with a small guide on how to test it locally. It may take some days until everything is merged so this way, you will have a functional workflow.

jjarava-transmit commented 3 months ago

Hi! From what I can see, #66 is already merged and the new release (https://github.com/jason0x43/alfred-toggl/releases/tag/v2.13.0) works fine! Thanks @s7anley for the assist and @jason0x43 for creating and keeping this going, thanks!!

I don't know how to "close" this issue, but it is no longer an issue! 🙇‍♂️