### Setup and Run TaskRatchet.com Development Server - Bash Source: https://github.com/taskratchet/taskratchet-docs/blob/master/README.md Installs project dependencies using pnpm and starts the local development server. Requires Node.js and pnpm to be installed. ```bash pnpm install pnpm run dev ``` -------------------------------- ### Example Response: GET me/tasks (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example JSON response for the GET me/tasks endpoint, showing the structure of an array containing task objects. ```json [ { "id": "tdDPzh1GpZHAGZURVBf6", "task": "Take out the trash", "due": "2/21/2022, 11:59 PM", "due_timestamp": 1645505940, "cents": 500, "complete": false, "status": "pending", "timezone": "America/Cancun" } ] ``` -------------------------------- ### GET me Response Example (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v2.md An example JSON response returned by the GET me endpoint, showing user profile data including ID, name, email, timezone, integrations, and Stripe customer status. ```json { "id": "Zu0qDVncIgSuUbQfr261", "name": "Jon Doe", "email": "jon@doe.com", "timezone": "America/New_York", "integrations": { "beeminder": { "user": "jondoe", "goal_new_tasks": "tr_tasks" } }, "has_stripe_customer": true } ``` -------------------------------- ### Starting Development Server with PNPM Source: https://github.com/taskratchet/taskratchet-docs/blob/master/knowledge.md Starts the local development server for the VitePress documentation site. This allows previewing changes in real-time during development. ```Shell pnpm run dev ``` -------------------------------- ### Example Response: GET status (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example JSON response from the GET status endpoint, showing the API server's internal UTC time. ```json { "utc_now": "2022-07-12T18:52:41.647995+00:00" } ``` -------------------------------- ### GET me/tasks Response Example (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v2.md An example JSON response returned by the GET me/tasks endpoint, showing an array of task objects. Each task includes ID, description, due date (Unix timestamp), stake in cents, completion status, and overall status. ```json [ { "id": "tdDPzh1GpZHAGZURVBf6", "task": "Take out the trash", "due": 1614556800, "cents": 100, "complete": false, "status": "pending" } ] ``` -------------------------------- ### Installing Dependencies with PNPM Source: https://github.com/taskratchet/taskratchet-docs/blob/master/knowledge.md Installs project dependencies using the PNPM package manager. This command should be run after cloning the repository to set up the development environment. ```Shell pnpm install ``` -------------------------------- ### Example Response: GET me/tasks/{task_id} (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example JSON response for retrieving a single task using the GET me/tasks/{task_id} endpoint. ```json { "id": "tdDPzh1GpZHAGZURVBf6", "task": "Take out the trash", "due": "2/21/2022, 11:59 PM", "due_timestamp": 1645505940, "cents": 500, "complete": false, "status": "pending", "timezone": "America/Cancun" } ``` -------------------------------- ### Example Response: POST me/tasks (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example JSON response returned after successfully creating a task via the POST me/tasks endpoint. ```json { "id": "tdDPzh1GpZHAGZURVBf6", "task": "Take out the trash", "due": "2/21/2022, 11:59 PM", "due_timestamp": 1645505940, "cents": 500, "complete": false, "status": "pending", "timezone": "America/Cancun" } ``` -------------------------------- ### Example Request: POST me/tasks (Bash) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example curl command to create a new task using the POST me/tasks endpoint. Requires user ID, API token, and task details in the request body. ```bash curl -X POST "https://api.taskratchet.com/api1/me/tasks" \ -H "X-Taskratchet-Userid: YOUR_USER_ID" \ -H "X-Taskratchet-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "task": "Take out the trash", "due": "3/25/2023, 11:59 PM", "cents": 500 }' ``` -------------------------------- ### Authenticating with TaskRatchet API - JavaScript (Fetch) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Shows how to make an authenticated GET request to the TaskRatchet API /me endpoint using JavaScript's fetch API. Authentication is done by including 'X-Taskratchet-Userid' and 'X-Taskratchet-Token' in the headers object. The example parses the response as JSON and logs it to the console. Requires a JavaScript environment supporting async/await and fetch. ```JavaScript const response = await fetch('https://api.taskratchet.com/api1/me', { headers: { 'X-Taskratchet-Userid': 'YOUR_USER_ID', 'X-Taskratchet-Token': 'YOUR_API_TOKEN' } }); const data = await response.json(); console.log(data); ``` -------------------------------- ### Authenticating with TaskRatchet API - cURL Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Provides a command-line example using cURL to make an authenticated GET request to the TaskRatchet API /me endpoint. Authentication credentials ('X-Taskratchet-Userid' and 'X-Taskratchet-Token') are passed as custom headers using the -H flag. ```cURL curl -X GET "https://api.taskratchet.com/api1/me" \ -H "X-Taskratchet-Userid: YOUR_USER_ID" \ -H "X-Taskratchet-Token: YOUR_API_TOKEN" ``` -------------------------------- ### Authenticating with TaskRatchet API - Python Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Demonstrates how to make an authenticated GET request to the TaskRatchet API /me endpoint using Python's requests library. Requires the 'requests' library. Authentication is performed using 'X-Taskratchet-Userid' and 'X-Taskratchet-Token' headers. The example prints the JSON response received from the API. ```Python import requests headers = { 'X-Taskratchet-Userid': 'YOUR_USER_ID', 'X-Taskratchet-Token': 'YOUR_API_TOKEN' } response = requests.get('https://api.taskratchet.com/api1/me', headers=headers) print(response.json()) ``` -------------------------------- ### POST me/tasks Response Example (JSON) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v2.md An example JSON response returned upon successful creation of a new task via the POST me/tasks endpoint. It shows the structure of the newly created task object, including its ID, description, due date, stake, completion status, and overall status. ```json { "id": "tdDPzh1GpZHAGZURVBf6", "task": "Take out the trash", "due": 1614556800, "cents": 100, "complete": false, "status": "pending" } ``` -------------------------------- ### Example Request: PUT me/tasks/{task_id} (Bash) Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Example curl command to update a specific task using the PUT me/tasks/{task_id} endpoint. Currently supports marking a task as complete. ```bash curl -X PUT "https://api.taskratchet.com/api1/me/tasks/tdDPzh1GpZHAGZURVBf6" \ -H "X-Taskratchet-Userid: YOUR_USER_ID" \ -H "X-Taskratchet-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "complete": true }' ``` -------------------------------- ### Building Production Site with PNPM Source: https://github.com/taskratchet/taskratchet-docs/blob/master/knowledge.md Builds the static production version of the VitePress documentation site. The output is typically placed in a 'dist' directory, ready for deployment. ```Shell pnpm run build ``` -------------------------------- ### Updating User Profile with TaskRatchet API - cURL Source: https://github.com/taskratchet/taskratchet-docs/blob/master/src/api-v1.md Demonstrates how to make an authenticated PUT request to the TaskRatchet API /me endpoint using cURL to update user profile information. Authentication requires 'X-Taskratchet-Userid' and 'X-Taskratchet-Token' headers. The request includes a 'Content-Type: application/json' header and the update data is provided as a JSON string in the request body using the -d flag. ```cURL curl -X PUT "https://api.taskratchet.com/api1/me" \ -H "X-Taskratchet-Userid: YOUR_USER_ID" \ -H "X-Taskratchet-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Jon Doe", "timezone": "America/Los_Angeles" }' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.