### Example JSON Response for Tasks Source: https://lunatask.app/api/tasks-api/list This is an example of the JSON structure returned by the Lunatask API when retrieving tasks. It includes an array of task objects, each with details like ID, status, priority, and source information. ```json { "tasks": [ { "id": "066b5835-184f-4fd9-be60-7d735aa94708", "area_id": "11b37775-5a34-41bb-b109-f0e5a6084799", "goal_id": null, "status": "next", "previous_status": "later", "estimate": 10, "priority": 0, "progress": 25, "motivation": "unknown", "eisenhower": 0, "sources": [ { "source": "github", "source_id": "123" } ], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" }, { "id": "0e0cff5c-c334-4a24-b15a-4fca6cfbf25f", "area_id": "f557287e-ae43-4472-9478-497887362dcb", "goal_id": null, "status": "later", "previous_status": null, "estimate": 120, "priority": 0, "motivation": "unknown", "eisenhower": 0, "progress": null, "sources": [], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:26Z", "updated_at": "2021-01-10T10:39:26Z" } ] } ``` -------------------------------- ### Create Note via API (Ruby) Source: https://lunatask.app/api/person-timeline-notes-api/create This Ruby code snippet demonstrates how to create a new note for a person's memory timeline using the Lunatask API. It utilizes the `rest-client` gem to send a POST request with the note details and authentication token. Ensure you have the `rest-client` gem installed. ```ruby require 'rest-client' access_token = 'xxx' payload = { person_id: '5999b945-b2b1-48c6-aa72-b251b75b3c2e', date_on: '2021-01-10', content: 'Today we talked about ...' } RestClient.post('https://api.lunatask.app/v1/person_timeline_notes', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }) ``` -------------------------------- ### Create Note via API (Ruby) Source: https://lunatask.app/api/notes-api/create This Ruby code snippet demonstrates how to create a new note using the Lunatask API. It utilizes the `rest-client` gem to send a POST request with JSON payload and authorization headers. The example includes optional parameters like `source`, `source_id`, and `notebook_id`. ```ruby require 'rest-client' access_token = 'xxx' payload = { name: 'My new note', content: 'My important note content', source: 'evernote', source_id: '352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7', notebook_id: '11b37775-5a34-41bb-b109-f0e5a6084799' } RestClient.post('https://api.lunatask.app/v1/notes', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }) ``` -------------------------------- ### Retrieve All Tasks via HTTP GET Request Source: https://lunatask.app/api/tasks-api/list This snippet demonstrates how to retrieve all tasks from the Lunatask API using an HTTP GET request. It shows the endpoint URL and how to include an authorization token. The request can be filtered by optional query parameters like 'source' and 'source_id'. ```http GET https://api.lunatask.app/v1/tasks ``` -------------------------------- ### Retrieve All Notes via HTTP GET Request Source: https://lunatask.app/api/notes-api/list This snippet demonstrates how to retrieve all notes from the Lunatask API using an HTTP GET request. It shows how to include an authorization token in the request headers. The request can be optionally filtered by 'source' and 'source_id' query parameters. ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/notes', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### Test API Connection with /v1/ping Endpoint (Ruby) Source: https://lunatask.app/api/authentication This code snippet demonstrates how to test your API integration by sending a GET request to the /v1/ping endpoint. It includes the necessary 'rest-client' library and shows how to correctly format the Authorization header with your access token. The expected response is a JSON object with a 'message' field set to 'pong'. ```ruby require 'rest-client' RestClient.get('https://api.lunatask.app/v1/ping', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### GET /v1/people Source: https://lunatask.app/api/people-api/list Retrieves all people in your account. Filters can be applied using the 'source' and 'source_id' query parameters. ```APIDOC ## GET /v1/people ### Description This endpoint retrieves all people in your account. You can narrow down the data returned by filtering on the source of the person. ### Method GET ### Endpoint https://api.lunatask.app/v1/people ### Parameters #### Query Parameters - **source** (string) - Optional - The `source` specified when creating the person. - **source_id** (string) - Optional - The `source_id` specified when creating the person. If no source is specified, all people are returned. ### Request Example ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/people', { Authorization: "bearer #{access_token}" }) ``` ### Response #### Success Response (200) - **people** (array) - A list of people objects. - **id** (string) - The unique identifier for the person. - **relationship_strength** (string) - The strength of the relationship. - **sources** (array) - A list of sources associated with the person. - **source** (string) - The name of the source. - **source_id** (string) - The ID of the person from the source. - **created_at** (string) - The timestamp when the person was created. - **updated_at** (string) - The timestamp when the person was last updated. #### Response Example ```json { "people": [ { "id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e", "relationship_strength": "business-contacts", "sources": [ { "source": "salesforce", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" } ], "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" }, { "id": "109cbf01-dba9-4136-8cf1-a02084ba3977", "relationship_strength": "family", "sources": [], "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } ] } ``` ``` -------------------------------- ### Retrieve Tasks using Ruby REST Client Source: https://lunatask.app/api/tasks-api/list This Ruby code snippet shows how to make a GET request to the Lunatask API to retrieve all tasks. It utilizes the 'rest-client' gem and requires an access token for authentication. The response is expected to be in JSON format. ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/tasks', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### Retrieve All People (Ruby) Source: https://lunatask.app/api/people-api/list This snippet demonstrates how to retrieve all people from a Lunatask account using Ruby's RestClient library. It requires an access token for authentication and sends a GET request to the /v1/people endpoint. The response will be a JSON object containing an array of people. ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/people', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### Retrieve Person by ID using Ruby Source: https://lunatask.app/api/people-api/show This Ruby code snippet demonstrates how to make a GET request to the Lunatask API to retrieve a specific person's details using their unique ID. It requires the 'rest-client' gem and an access token for authorization. The input is the person's ID, and the output is a JSON object containing the person's information. ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/people/5999b945-b2b1-48c6-aa72-b251b75b3c2e', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### POST /v1/notes Source: https://lunatask.app/api/notes-api/create This endpoint creates a new note within a specified notebook. If a note with the same source and source_id already exists in the target notebook, it returns a 204 No Content status without creating a duplicate. ```APIDOC ## POST /v1/notes ### Description Creates a new note. If a note with the same source and source_id already exists in the same notebook, it returns `204 No Content`. ### Method POST ### Endpoint `https://api.lunatask.app/v1/notes` ### Parameters #### Request Body - **notebook_id** (string) - Optional - The ID of the notebook where the note should be created. - **name** (string) - Optional - The name of the note. - **content** (string) - Optional - The content of the note, formatted in Markdown. - **date_on** (string) - Optional - A date assigned to the note, ISO-8601 formatted. - **source** (string) - Optional - Identification of the external system where the note is coming from (e.g., `"evernote"`). - **source_id** (string) - Optional - The ID of the record in the external system (e.g., `"352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7"`). ### Request Example ```json { "name": "My new note", "content": "My important note content", "source": "evernote", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7", "notebook_id": "11b37775-5a34-41bb-b109-f0e5a6084799" } ``` ### Response #### Success Response (200) - **note** (object) - Contains details of the created note. - **id** (string) - The unique identifier for the note. - **notebook_id** (string) - The ID of the notebook the note belongs to. - **date_on** (string|null) - The assigned date for the note. - **sources** (array) - An array of source objects associated with the note. - **source** (string) - The name of the external source. - **source_id** (string) - The ID of the record in the external system. - **created_at** (string) - Timestamp when the note was created. - **updated_at** (string) - Timestamp when the note was last updated. #### Response Example (200 OK) ```json { "note": { "id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e", "notebook_id": "d1ff35f5-6b25-4199-ab6e-c19fe3fe27f1", "date_on": null, "sources": [ { "source": "evernote", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" } ], "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } } ``` #### Success Response (204 No Content) Returned when a note with the same `source` and `source_id` already exists in the specified `notebook_id`. ``` -------------------------------- ### Create Journal Entry via API (Ruby) Source: https://lunatask.app/api/journal-api/create This snippet demonstrates how to create a new journal entry using the Lunatask API with Ruby. It utilizes the 'rest-client' library to send a POST request with the entry's date and content. Ensure you have a valid access token for authorization. ```ruby require 'rest-client' access_token = 'xxx' RestClient.post( 'https://api.lunatask.app/v1/journal_entries', { date_on: '2021-01-10', content: 'Today was a tough day, but on the other side...' }.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' } ) ``` -------------------------------- ### Create Person API Request (Ruby) Source: https://lunatask.app/api/people-api/create This Ruby code snippet demonstrates how to make a POST request to the Lunatask API to create a new person. It includes setting the access token, defining the payload with person details, and sending the request with appropriate headers for authorization and content type. ```ruby require 'rest-client' access_token = 'xxx' payload = { first_name: 'John', last_name: 'Doe', relationship_strength: 'business-contacts', source: 'salesforce', source_id: '352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7', } RestClient.post('https://api.lunatask.app/v1/people', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }) ``` -------------------------------- ### Create Task using Ruby Source: https://lunatask.app/api/tasks-api/create This snippet demonstrates how to create a new task via the Lunatask API using Ruby's 'rest-client' library. It sends a POST request to the tasks endpoint with task details in the JSON payload and includes an authorization token. The API may return a 204 No Content status if a similar task already exists. ```ruby require 'rest-client' access_token = 'xxx' payload = { name: 'My task', area_id: '11b37775-5a34-41bb-b109-f0e5a6084799', source: 'github', source_id: '123' } RestClient.post('https://api.lunatask.app/v1/tasks', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }) ``` -------------------------------- ### POST /v1/tasks Source: https://lunatask.app/api/tasks-api/create This endpoint creates a new task within the Lunatask application. It allows for detailed task information to be provided, including its area, associated goal, name, notes, status, and other metadata. If a task with the same source and source_id already exists and is not completed, the API will return a 204 No Content status without creating a duplicate. ```APIDOC ## POST /v1/tasks ### Description Creates a new task. If a task with the same `source` and `source_id` already exists and is not completed, a `204 No Content` is returned. ### Method POST ### Endpoint `https://api.lunatask.app/v1/tasks` ### Parameters #### Request Body - **area_id** (UUID) - Required - The Area ID of the list where the task should be created. - **goal_id** (UUID) - Optional - The ID of the goal where the task should be created. - **name** (string) - Optional - The name of the task. - **note** (string) - Optional - The note attached to the task (formatted in Markdown). - **status** (string) - Optional - The status of the task (see possible values). - **motivation** (string) - Optional - The motivation value of the task (see possible values). - **eisenhower** (integer) - Optional - The quadrant on Eisenhower matrix (see possible values). - **estimate** (integer) - Optional - The estimate of the task (in minutes). - **priority** (integer) - Optional - Priority of the task (see possible values). - **scheduled_on** (string) - Optional - ISO-8601 formatted date the task is scheduled on. - **completed_at** (string) - Optional - ISO-8601 formatted time when the task was completed. - **source** (string) - Optional - Identification of external system where the task is coming from (e.g., `"github"`). - **source_id** (string) - Optional - The ID of the record in the external system (e.g., `"123"`). ### Request Example ```json { "name": "My task", "area_id": "11b37775-5a34-41bb-b109-f0e5a6084799", "source": "github", "source_id": "123" } ``` ### Response #### Success Response (200) - **task** (object) - Contains the created task details. - **id** (string) - The unique identifier of the task. - **area_id** (string) - The ID of the area the task belongs to. - **goal_id** (string|null) - The ID of the goal the task is associated with, or null. - **status** (string) - The current status of the task. - **previous_status** (string|null) - The previous status of the task, or null. - **estimate** (integer|null) - The estimated time for the task, or null. - **priority** (integer) - The priority level of the task. - **progress** (integer|null) - The progress of the task, or null. - **motivation** (string) - The motivation level associated with the task. - **eisenhower** (integer) - The Eisenhower matrix quadrant. - **sources** (array) - An array of source objects for the task. - **source** (string) - The source system identifier. - **source_id** (string) - The ID of the record in the source system. - **scheduled_on** (string|null) - The date the task is scheduled on, or null. - **completed_at** (string|null) - The timestamp when the task was completed, or null. - **created_at** (string) - The timestamp when the task was created. - **updated_at** (string) - The timestamp when the task was last updated. #### Response Example ```json { "task": { "id": "066b5835-184f-4fd9-be60-7d735aa94708", "area_id": "11b37775-5a34-41bb-b109-f0e5a6084799", "goal_id": null, "status": "later", "previous_status": null, "estimate": null, "priority": 0, "progress": null, "motivation": "unknown", "eisenhower": 0, "sources": [ { "source": "github", "source_id": "123" } ], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } } ``` #### Success Response (204) No Content - Returned when a duplicate task (same source/source_id) is found and not created. ``` -------------------------------- ### POST /v1/person_timeline_notes Source: https://lunatask.app/api/person-timeline-notes-api/create Creates a new note for a given date on a person's memory timeline within the relationships section of the app. ```APIDOC ## POST /v1/person_timeline_notes ### Description Creates a new note for a given date on a person's memory timeline in the relationships section of the app. ### Method POST ### Endpoint `https://api.lunatask.app/v1/person_timeline_notes` ### Parameters #### Request Body - **person_id** (string) - Required - The Person ID of the person. - **date_on** (string) - Optional - ISO-8601 formatted date. Defaults to today if not provided. - **content** (string) - Optional - The content of the note, formatted in Markdown. ### Request Example ```json { "person_id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e", "date_on": "2021-01-10", "content": "Today we talked about ..." } ``` ### Response #### Success Response (200) - **person_timeline_note** (object) - Contains details of the created note. - **id** (string) - The unique identifier for the note. - **date_on** (string) - The date associated with the note. - **created_at** (string) - The timestamp when the note was created. - **updated_at** (string) - The timestamp when the note was last updated. #### Response Example ```json { "person_timeline_note": { "id": "6aa0d6e8-3b07-40a2-ae46-1bc272a0f472", "date_on": "2021-01-10", "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } } ``` ``` -------------------------------- ### Retrieve all notes Source: https://lunatask.app/api/notes-api/list This endpoint retrieves all notes in your account. You can narrow down the data returned by filtering on the source of the note. ```APIDOC ## GET /v1/notes ### Description Retrieves all notes in the user's account. Filtering by source is supported. ### Method GET ### Endpoint `/v1/notes` ### Query Parameters - **source** (string) - Optional - The `source` specified when creating the note. - **source_id** (string) - Optional - The `source_id` specified when creating the note. If no source is specified, all notes are returned. ### Request Example ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/notes', { Authorization: "bearer #{access_token}" }) ``` ### Response #### Success Response (200) - **notes** (array) - An array of note objects. - **id** (string) - The unique identifier for the note. - **notebook_id** (string) - The identifier for the notebook the note belongs to. - **date_on** (string/null) - The date associated with the note. - **sources** (array) - An array of source objects associated with the note. - **source** (string) - The source of the note (e.g., 'evernote'). - **source_id** (string) - The unique identifier from the source. - **created_at** (string) - The timestamp when the note was created. - **updated_at** (string) - The timestamp when the note was last updated. #### Response Example ```json { "notes": [ { "id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e", "notebook_id": "d1ff35f5-6b25-4199-ab6e-c19fe3fe27f1", "date_on": null, "sources": [ { "source": "evernote", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" } ], "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" }, { "id": "2ca8eb4c-4825-47e4-84de-2bbe0017b6c0", "notebook_id": "fc2aa380-3320-4525-8611-7332d5060478", "date_on": null, "sources": [], "created_at": "2021-01-13T08:12:25Z", "updated_at": "2021-01-15T10:39:25Z" } ] } ``` ``` -------------------------------- ### Track Habit Activity via API (Ruby) Source: https://lunatask.app/api/habits-api/track-activity This Ruby code snippet demonstrates how to send a POST request to the Lunatask API to record activity for a specific habit. It requires the habit ID and the date of performance, sent as JSON in the request body, along with an authorization token. ```ruby require 'rest-client' access_token = 'xxx' RestClient.post( 'https://api.lunatask.app/v1/habits/25b8ad7e-a89b-4f05-8173-83fcd2e21ae2/track', { performed_on: '2024-08-26' }.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' } ) ``` -------------------------------- ### POST /v1/people Source: https://lunatask.app/api/people-api/create Creates a new person or relationship entry in the Lunatask system. If a person with the same source and source_id already exists, it returns a 204 No Content response. ```APIDOC ## POST /v1/people ### Description Creates a new person or relationship entry. If a duplicate based on `source` and `source_id` is found, returns 204 No Content. ### Method POST ### Endpoint `https://api.lunatask.app/v1/people` ### Parameters #### Request Body - **first_name** (string) - Required - A person's first name. - **last_name** (string) - Required - A person's last name. - **relationship_strength** (string) - Optional - One of `family`, `extended-family`, `intimate-friends`, `close-friends`, `casual-friends`, `acquaintances`, `business-contacts`, or `almost-strangers`. Defaults to `casual-friends`. - **source** (string) - Optional - Identification of the external system where the record originates (e.g., `"salesforce"`). - **source_id** (string) - Optional - The ID of the record in the external system (e.g., `"352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7"`). - **email** (string) - Optional - A person's email address. Requires custom field definition. - **birthday** (string) - Optional - A person's birthday in ISO-8601 format. Requires custom field definition. - **phone** (string) - Optional - A person's phone number. Requires custom field definition. ### Request Example ```json { "first_name": "John", "last_name": "Doe", "relationship_strength": "business-contacts", "source": "salesforce", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" } ``` ### Response #### Success Response (201 Created) - **person** (object) - **id** (string) - The unique identifier for the created person. - **relationship_strength** (string) - The relationship strength. - **sources** (array) - An array of source objects. - **source** (string) - The name of the source system. - **source_id** (string) - The ID of the record in the source system. - **created_at** (string) - Timestamp of creation (ISO-8601). - **updated_at** (string) - Timestamp of last update (ISO-8601). #### Success Response (204 No Content) Returned when a duplicate person is found based on `source` and `source_id`. #### Error Response (402 Payment Required) Returned when the number of people on the Free plan reaches its limit. #### Error Response (422 Unprocessable Entity) Returned if custom fields for email, birthday, or phone are not defined. #### Response Example (201 Created) ```json { "person": { "id": "5999b945-b2b1-48c6-aa72-b251b75b3c2e", "relationship_strength": "business-contacts", "sources": [ { "source": "salesforce", "source_id": "352fd2d7-cdc0-4e91-a0a3-9d6cc9d440e7" } ], "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } } ``` ``` -------------------------------- ### Retrieve all tasks Source: https://lunatask.app/api/tasks-api/list This endpoint retrieves all tasks in your account. You can narrow down the data returned by filtering on the source of the task. ```APIDOC ## GET /v1/tasks ### Description Retrieves all tasks in the user's account. Supports filtering by task source. ### Method GET ### Endpoint `https://api.lunatask.app/v1/tasks` ### Parameters #### Query Parameters - **source** (string) - Optional - The `source` specified when creating the task. - **source_id** (string) - Optional - The `source_id` specified when creating the task. If no source is specified, all tasks are returned. ### Request Example ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/tasks', { Authorization: "bearer #{access_token}" }) ``` ### Response #### Success Response (200) - **tasks** (array) - A list of task objects. - **id** (string) - The unique identifier for the task. - **area_id** (string) - The identifier for the area the task belongs to. - **goal_id** (string or null) - The identifier for the goal the task is associated with. - **status** (string) - The current status of the task (e.g., 'next', 'later'). - **previous_status** (string or null) - The previous status of the task. - **estimate** (integer) - The estimated time for the task in minutes. - **priority** (integer) - The priority level of the task. - **progress** (integer or null) - The progress of the task as a percentage. - **motivation** (string) - Motivation associated with the task. - **eisenhower** (integer) - Eisenhower matrix category. - **sources** (array) - A list of sources for the task. - **source** (string) - The name of the source. - **source_id** (string) - The identifier from the source. - **scheduled_on** (string or null) - The date the task is scheduled for. - **completed_at** (string or null) - The timestamp when the task was completed. - **created_at** (string) - The timestamp when the task was created. - **updated_at** (string) - The timestamp when the task was last updated. #### Response Example ```json { "tasks": [ { "id": "066b5835-184f-4fd9-be60-7d735aa94708", "area_id": "11b37775-5a34-41bb-b109-f0e5a6084799", "goal_id": null, "status": "next", "previous_status": "later", "estimate": 10, "priority": 0, "progress": 25, "motivation": "unknown", "eisenhower": 0, "sources": [ { "source": "github", "source_id": "123" } ], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" }, { "id": "0e0cff5c-c334-4a24-b15a-4fca6cfbf25f", "area_id": "f557287e-ae43-4472-9478-497887362dcb", "goal_id": null, "status": "later", "previous_status": null, "estimate": 120, "priority": 0, "motivation": "unknown", "eisenhower": 0, "progress": null, "sources": [], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:26Z", "updated_at": "2021-01-10T10:39:26Z" } ] } ``` ``` -------------------------------- ### POST /v1/journal_entries Source: https://lunatask.app/api/journal-api/create This endpoint creates a new journal entry for a given date. It allows you to specify the date, an optional name, and the content of the entry in Markdown format. ```APIDOC ## POST /v1/journal_entries ### Description Creates a new journal entry for a specified date. The entry can include a name and content formatted in Markdown. ### Method POST ### Endpoint https://api.lunatask.app/v1/journal_entries ### Parameters #### Request Body - **date_on** (string) - Required - ISO-8601 formatted date (e.g., '2021-01-10'). - **name** (string) - Optional - The name for the entry. If omitted, the app will generate a name based on the date. - **content** (string) - Required - The content of the entry, formatted in Markdown. ### Request Example ```json { "date_on": "2021-01-10", "name": "My Journal Entry", "content": "# My Thoughts\nToday was a tough day, but on the other side..." } ``` ### Response #### Success Response (200) - **journal_entry** (object) - Contains details of the created journal entry. - **id** (string) - The unique identifier for the journal entry. - **date_on** (string) - The date associated with the journal entry. - **created_at** (string) - The timestamp when the entry was created. - **updated_at** (string) - The timestamp when the entry was last updated. #### Response Example ```json { "journal_entry": { "id": "6aa0d6e8-3b07-40a2-ae46-1bc272a0f472", "date_on": "2021-01-10", "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } } ``` ``` -------------------------------- ### Retrieve Task by ID using Ruby Source: https://lunatask.app/api/tasks-api/show This snippet demonstrates how to retrieve a specific task from the LunaTask API using Ruby's RestClient library. It requires an access token for authentication and specifies the task ID in the URL. ```ruby require 'rest-client' access_token = 'xxx' RestClient.get('https://api.lunatask.app/v1/tasks/066b5835-184f-4fd9-be60-7d735aa94708', { Authorization: "bearer #{access_token}" }) ``` -------------------------------- ### Ping Endpoint Source: https://lunatask.app/api/authentication This endpoint is used to verify the API connection and authentication. It requires an access token in the Authorization header. ```APIDOC ## GET /v1/ping ### Description Tests the API connection by returning a 'pong' message. Requires a valid access token. ### Method GET ### Endpoint /v1/ping ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., `Bearer YOUR_ACCESS_TOKEN`) ### Request Example ```ruby require 'rest-client' access_token = 'YOUR_ACCESS_TOKEN' RestClient.get('https://api.lunatask.app/v1/ping', { Authorization: "bearer #{access_token}" }) ``` ### Response #### Success Response (200) - **message** (string) - Indicates a successful connection, expected to be 'pong'. #### Response Example ```json { "message": "pong" } ``` ``` -------------------------------- ### POST /v1/habits/{id}/track Source: https://lunatask.app/api/habits-api/track-activity This endpoint records activity for a specific habit on a given date. It requires the habit ID and the date the activity was performed. ```APIDOC ## POST /v1/habits//track ### Description This endpoint records activity for a specific habit on a given date. ### Method POST ### Endpoint `https://api.lunatask.app/v1/habits//track` ### Parameters #### Path Parameters - **id** (UUID) - Required - The ID of the habit (UUID, can be found in our apps in the habit settings) #### Query Parameters None #### Request Body - **performed_on** (string) - Required - ISO-8601 formatted date when the activity was performed ### Request Example ```json { "performed_on": "2024-08-26" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the operation, expected to be "ok". #### Error Response (e.g., 400 Bad Request) - **status** (string) - Indicates the status of the operation, expected to be "error". - **message** (string) - Provides details about the error, such as a missing or malformed date. #### Response Example (Success) ```json { "status": "ok" } ``` #### Response Example (Error) ```json { "status": "error", "message": "performed_on date missing or is not a valid ISO-8601 formatted date" } ``` ``` -------------------------------- ### Update Note API Request in Ruby Source: https://lunatask.app/api/notes-api/update This snippet demonstrates how to update a specific note using the `PUT` request to the Lunatask API. It requires an access token for authentication and sends the updated note content in the request body. The `id` in the URL specifies which note to update. ```ruby require 'rest-client' access_token = 'xxx' payload = { content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit...' } RestClient.put('https://api.lunatask.app/v1/notes/5999b945-b2b1-48c6-aa72-b251b75b3c2e', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }) ``` -------------------------------- ### Task Entity Attributes Source: https://lunatask.app/api/tasks-api/entity This section describes the attributes of the Task entity and their possible values. ```APIDOC ## Task Entity Attributes All operations on Tasks API return the latest representation of Task entity. ### Attributes - **id** (UUID) - The ID of the task. - **area_id** (UUID) - The ID of the area of life the task belongs in. - **goal_id** (UUID) - The ID of the goal the task belongs in (optional). - **status** (string) - Current status of the task. Allowed values: `"later"`, `"next"`, `"started"`, `"waiting"`, `"completed"`. - **previous_status** (string) - Previous status of the task (optional). Allowed values: `"later"`, `"next"`, `"started"`, `"waiting"`, `"completed"`. - **estimate** (integer) - Current value for estimate (optional, in minutes). - **priority** (integer) - Current priority. Range: `-2..2`. `2` (Highest), `1` (High), `0` (Normal/Clear), `-1` (Low), `-2` (Lowest). - **progress** (float) - Progress on the task (in percent or `null`). - **motivation** (string) - Current value of the motivation. Allowed values: `"must"`, `"should"`, `"want"`, `"unknown"` (Clear). - **eisenhower** (integer) - Current value on Eisenhower matrix. `1` (Urgent and Important), `2` (Urgent, not important), `3` (Important, not urgent), `4` (Not urgent or important), `0` (Uncategorized/Clear). - **sources** (array) - Array of references to data records in external systems. - **scheduled_on** (ISO-8601 date) - ISO-8601 formatted date when the task is scheduled on (optional). - **completed_at** (ISO-8601 datetime) - ISO-8601 formatted time when the task was completed (optional). - **created_at** (ISO-8601 datetime) - ISO-8601 formatted time when the task was created. - **updated_at** (ISO-8601 datetime) - ISO-8601 formatted time when the task was last updated. ### Example JSON Representation ```json { "id": "066b5835-184f-4fd9-be60-7d735aa94708", "area_id": "11b37775-5a34-41bb-b109-f0e5a6084799", "goal_id": null, "status": "next", "previous_status": "later", "estimate": 10, "priority": 0, "progress": null, "motivation": "unknown", "eisenhower": 0, "sources": [ { "source": "github", "source_id": "123" } ], "scheduled_on": null, "completed_at": null, "created_at": "2021-01-10T10:39:25Z", "updated_at": "2021-01-10T10:39:25Z" } ``` ``` -------------------------------- ### Delete Task by ID using Ruby Source: https://lunatask.app/api/tasks-api/delete This snippet demonstrates how to delete a specific task by its ID using the Ruby RestClient library. It requires an access token for authentication and sends a DELETE request to the Lunatask API. ```ruby require 'rest-client' access_token = 'xxx' RestClient.delete('https://api.lunatask.app/v1/tasks/066b5835-184f-4fd9-be60-7d735aa94708', { Authorization: "bearer #{access_token}" }) ```