RedditPP Mascot

RedditPP

r/tasker • … • u/XavierNovella

Toggle API - Start Entry - Help to make it work

I have seen a couple of posts with the same issue since the change from API v8 to v9. In their documentation, the code examples to start a new entry is very different and not as complete as the other actions you can do through the API.

[https://engineering.toggl.com/docs/tracking#run-a-new-time-entry](https://engineering.toggl.com/docs/tracking#run-a-new-time-entry)

I have been able to create other tasks that retrieve the "current time entry" and even reuse some of the information (project ID) to set the color to "gray" if pid is null or reuse the pid in a following call to get the color of the project.

However, I am not able to start any task.

This is what I am trying, but I receive a Error:1 JSON is not valid.

Can somebody help?

Task: TOGGL - START ENTRY Testtt

A1: Perform Task [ Name: TOGGL - START Priority: %priority Structure Output (JSON, etc): On ]

A2: Variable Set [ Name: %Tgglldng To: 1 ]

A3: WM Send Variable [ Configuration: %Tgglldng Timeout (Seconds): 0 ]

A4: HTTP Auth [ Method: Username and Password Timeout (Seconds): 30 Username: %TogglApi Password: api_token ]

A5: Variable Set [ Name: %TogglHeaders To: %http_auth_headers Structure Output (JSON, etc): On ]

A6: HTTP Request [ Method: POST URL: https://api.track.toggl.com/api/v9/workspaces/%TogglWrkspc/time_entries Headers: %TogglHeaders Content-Type:application/json Body: {"created_with":"API example code","description":"Hello Toggl","tags":[],"billable":false,"workspace_id":{workspace_id},"duration":-1,"start":"2024-09-14T18:22:53.000Z","stop":null} Timeout (Seconds): 30 Structure Output (JSON, etc): On ]

A7: Flash [ Text: %http_data Continue Task Immediately: On Dismiss On Click: On ]

A8: Perform Task [ Name: TOGGL - CURRENT GET Priority: %priority ]

%Tgglldng is 0/1 to trigger a loading bar.

%ToggleApi is the api token

%ToggleHeaders is the string output from HTTP Auth.

%TogglWrkspc is my workspace ID.

Edit: exact example from API documentation does not work.

— 0