toggl / toggl_api_docs

Documentation for the Toggl API
1.4k stars 235 forks source link

[Question] GET URL to start timer automatically? #314

Closed kurko closed 5 years ago

kurko commented 6 years ago

Context

  1. I'm part of an organization
  2. I use the macOS desktop app
  3. My clients usually give me a link like https://www.toggl.com/app/projects/1095558/edit/72728211 to use as timers
  4. I use Safari, so I don't have access to an extension (Chrome and Firefox)

The problem

I usually have:

  1. to open the link on my browser
  2. copy the client and project name
  3. go to the Desktop app
  4. enter a new timer, pasting the values copied in step 2
  5. double check everything to make sure I didn't make a mistake

This is all cumbersome and tedious, given I have to working on multiple projects within a day.

The question

Is there a GET url that would automatically start the timer, so that I could just click it instead and it would automatically set my Desktop app to that particular client/project?

Example: for the link https://www.toggl.com/app/projects/1095558/edit/72728211, something like https://www.toggl.com/app/projects/1095558/edit/72728211?start-timer=true, which besides visiting the project, would also automatically start the timer (given I'm logged in in the browser).

I don't want an API call because I can't really just click a link then. A GET URL would be perfect.

Thanks.

joeySeal commented 5 years ago

Where you able to figure this out?

kurko commented 5 years ago

@joeySeal nope. Still living through the pain.

webervin commented 5 years ago

GET is supposed to be an idempotent HTTP method, it should not modify data, to allow efficient caching and retry for example.

However this request is noted and passed on to product team for discussion. To give us insight about demand for similar feature please use 👍 on first message of this issue. Thank you.

kurko commented 5 years ago

supposed to be an idempotent HTTP method

Yes, ?start-timer=true is idempotent. Not just GET should be idempotent, but the methods HEAD, PUT and DELETE also share this property.

it should not modify data

Not true, I don't think. So you don't have any Analytics change/record when someone calls a GET endpoint? 🤔 In the RFC itself that defines GET properties and how they should be safe,

For example, most servers append request information to access log files at the completion of every response, regardless of the method, and that is considered safe even though the log storage might become full and crash the server. Likewise, a safe request initiated by selecting an advertisement on the Web will often have the side effect of charging an advertising account.

Furthermore,

When a resource is constructed such that parameters within the effective request URI have the effect of selecting an action, it is the resource owner's responsibility to ensure that the action is consistent with the request method semantics. For example, it is common for Web-based content editing software to use actions within query parameters, such as "page?do=delete". If the purpose of such a resource is to perform an unsafe action, then the resource owner MUST disable or disallow that action when it is accessed using a safe request method.

Is starting a timer unsafe, given I add ?start-time=true? Don't think so, by the definition above.

webervin commented 5 years ago

Thank you for quotes, to clarify it more, I will quote from your link:

"Naturally, it is not possible to ensure that the server does not generate side-effects as a result of performing a GET request; in fact, some dynamic resources consider that a feature. The important distinction here is that the user did not request the side-effects, so therefore cannot be held accountable for them."

In case of requesting start of new timer, user also requests stop of previous timer, if one is running. This intentionally alters data belonging to workspace and should not happen with user not being accountable for such request.