Skip to content

Instantly share code, notes, and snippets.

@alejoasotelo
Created August 20, 2024 14:24
Show Gist options
  • Save alejoasotelo/89933bf89c7139a775147709cb7e812c to your computer and use it in GitHub Desktop.
Save alejoasotelo/89933bf89c7139a775147709cb7e812c to your computer and use it in GitHub Desktop.
Toggl HTTP API v9 for Rest Client VS Code
@apiToken =
@baseURL = https://api.track.toggl.com/api/v9/
@workspaceId = {{workspaces.response.body.$[0].id}}
// Busca un workspace id por su nombre. Cambiar MY_NAME por el name de tu workspace
@projectIdByName = {{projects_by_workspace.response.body.$[?(@.name == 'MY_NAME')].id}}
###
# @name me
GET {{baseURL}}me HTTP/1.1
Authorization: Basic {{apiToken}}:api_token
Content-Type: application/json
###
# @name workspaces
GET {{baseURL}}workspaces HTTP/1.1
Authorization: Basic {{apiToken}}:api_token
Content-Type: application/json
###
# @name projects_by_workspace
GET {{baseURL}}workspaces/{{workspaceId}}/projects HTTP/1.1
Authorization: Basic {{apiToken}}:api_token
Content-Type: application/json
###
# @name project_by_workspace
GET {{baseURL}}workspaces/{{workspaceId}}/projects/{{projectIdByName}} HTTP/1.1
Authorization: Basic {{apiToken}}:api_token
Content-Type: application/json
###
# @name me_time_entries
GET {{baseURL}}me/time_entries?start_date=2024-07-01&end_date=2024-08-01&meta=true&include_sharing=true HTTP/1.1
Authorization: Basic {{apiToken}}:api_token
Content-Type: application/json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment