AppMage

Task Manager

This endpoint group provides functionalities for managing task instances, which act as containers for tasks (e.g., project boards, to-do lists). It allows for creating, updating, retrieving, and deleting task instances.

Endpoints

POST /api/rpc (Method: TaskManagerRpc.create)

  • Description: Creates a new task instance (e.g., a project task board).

  • Request Body:

    {
      "method": "TaskManagerRpc.create",
      "params": {
        "name": "My New Project Board",
        "description": "A board for tracking project tasks.",
        "contextId": "projectId123",
        "contextType": "project",
        "accessControl": {
          "viewers": [],
          "editors": []
        },
        "metadata": {}
      }
    }
  • Parameters:

    Name Type Required Description
    name String Yes Instance name is required.
    description String No Optional description for the task instance.
    contextId String Yes The primary ID for scoping (e.g., projectId, userId, agentInstanceId).
    contextType Enum<project, user, agent, workflow, tool> Yes The type of context.
    accessControl Object No Defines who can view, edit, or comment on tasks within this instance.
    accessControl.viewers Array<String> No Arrays of MessagingContact IDs or Role names.
    accessControl.editors Array<String> No Arrays of MessagingContact IDs or Role names.
    accessControl.commenters Array<String> No Arrays of MessagingContact IDs or Role names.
    metadata Object No Flexible key-value metadata for additional context (e.g., { browserSessionId: 'xyz' }).
    isArchived Boolean No Whether this entire task instance is archived. Defaults to false.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "654321098765432109876543",
        "name": "My New Project Board",
        "description": "A board for tracking project tasks.",
        "contextId": "projectId123",
        "contextType": "project",
        "ownerId": "user123",
        "accessControl": {
          "viewers": [],
          "editors": [],
          "commenters": []
        },
        "metadata": {},
        "isArchived": false,
        "createdAt": "2023-10-27T10:00:00.000Z",
        "updatedAt": "2023-10-27T10:00:00.000Z"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.create",
        "params": {
          "name": "My New Project Board",
          "description": "A board for tracking project tasks.",
          "contextId": "projectId123",
          "contextType": "project"
        }
      }'

POST /api/rpc (Method: TaskManagerRpc.update)

  • Description: Updates an existing task instance's name or description.

  • Request Body:

    {
      "method": "TaskManagerRpc.update",
      "params": {
        "_id": "654321098765432109876543",
        "name": "Updated Project Board Name",
        "description": "New description for the project board.",
        "isArchived": true,
        "accessControl": {
          "viewers": ["contactId1"]
        }
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes MongoDB ObjectId of the task instance.
    name String No The new name for the task instance.
    description String No The new description for the task instance.
    isArchived Boolean No Whether this entire task instance is archived.
    accessControl Object No Defines who can view, edit, or comment on tasks within this instance.
    accessControl.viewers Array<String> No Arrays of MessagingContact IDs or Role names.
    accessControl.editors Array<String> No Arrays of MessagingContact IDs or Role names.
    accessControl.commenters Array<String> No Arrays of MessagingContact IDs or Role names.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "654321098765432109876543",
        "name": "Updated Project Board Name",
        "description": "New description for the project board.",
        "contextId": "projectId123",
        "contextType": "project",
        "ownerId": "user123",
        "accessControl": {
          "viewers": ["contactId1"],
          "editors": [],
          "commenters": []
        },
        "metadata": {},
        "isArchived": true,
        "createdAt": "2023-10-27T10:00:00.000Z",
        "updatedAt": "2023-10-27T10:05:00.000Z"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.update",
        "params": {
          "_id": "654321098765432109876543",
          "name": "Updated Project Board Name"
        }
      }'

POST /api/rpc (Method: TaskManagerRpc.delete)

  • Description: Deletes a task instance and all of its associated tasks.

  • Request Body:

    {
      "method": "TaskManagerRpc.delete",
      "params": {
        "_id": "654321098765432109876543"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The ID of the task instance to delete.
  • Response:

    {
      "success": true,
      "data": {
        "success": true,
        "deletedTaskCount": 5
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.delete",
        "params": {
          "_id": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: TaskManagerRpc.listForContext)

  • Description: Retrieves a list of task instances for a given context.

  • Request Body:

    {
      "method": "TaskManagerRpc.listForContext",
      "params": {
        "contextId": "projectId123",
        "contextType": "project"
      }
    }
  • Parameters:

    Name Type Required Description
    contextId String Yes The primary ID for scoping (e.g., projectId, userId, agentInstanceId).
    contextType Enum<project, user, agent, workflow, tool> Yes The type of context.
  • Response:

    {
      "success": true,
      "data": [
        {
          "_id": "654321098765432109876543",
          "name": "Project Board Alpha",
          "contextId": "projectId123",
          "contextType": "project",
          "ownerId": "user123",
          "isArchived": false,
          "createdAt": "2023-10-27T09:00:00.000Z",
          "updatedAt": "2023-10-27T09:00:00.000Z"
        },
        {
          "_id": "654321098765432109876544",
          "name": "Project Board Beta",
          "contextId": "projectId123",
          "contextType": "project",
          "ownerId": "user123",
          "isArchived": false,
          "createdAt": "2023-10-27T09:30:00.000Z",
          "updatedAt": "2023-10-27T09:30:00.000Z"
        }
      ]
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.listForContext",
        "params": {
          "contextId": "projectId123",
          "contextType": "project"
        }
      }'

POST /api/rpc (Method: TaskManagerRpc.findById)

  • Description: Retrieves a single task instance by its ID.

  • Request Body:

    {
      "method": "TaskManagerRpc.findById",
      "params": {
        "_id": "654321098765432109876543"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The ID of the task instance to retrieve.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "654321098765432109876543",
        "name": "Project Board Alpha",
        "description": "Description for Alpha board.",
        "contextId": "projectId123",
        "contextType": "project",
        "ownerId": "user123",
        "accessControl": {
          "viewers": [],
          "editors": [],
          "commenters": []
        },
        "metadata": {},
        "isArchived": false,
        "createdAt": "2023-10-27T09:00:00.000Z",
        "updatedAt": "2023-10-27T09:00:00.000Z"
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.findById",
        "params": {
          "_id": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: TaskManagerRpc.listAll)

  • Description: Retrieves a list of ALL task instances across all projects, with optional filtering. Requires admin-level permissions.

  • Request Body:

    {
      "method": "TaskManagerRpc.listAll",
      "params": {
        "filter": {
          "name": "Project",
          "contextId": "projectId456",
          "ownerId": "adminUser"
        },
        "sort": {
          "createdAt": -1
        },
        "page": 1,
        "pageSize": 20
      }
    }
  • Parameters:

    Name Type Required Description
    filter Object No Optional filters to apply to the task instances.
    filter.name String No Filters by task instance name (partial match).
    filter.contextId String No Filters by a specific context ID (e.g., a projectId).
    filter.ownerId String No Filters by the owner's ID.
    sort Object No Optional sort criteria (e.g., { "createdAt": -1 } for descending creation date).
    page Number No The page number for pagination. Defaults to 1.
    pageSize Number No The number of results per page. Defaults to 50.
  • Response:

    {
      "success": true,
      "data": {
        "data": [
          {
            "_id": "654321098765432109876545",
            "name": "Global Project A",
            "contextId": "projectABC",
            "contextType": "project",
            "ownerId": "adminUser",
            "isArchived": false,
            "createdAt": "2023-10-26T14:00:00.000Z",
            "updatedAt": "2023-10-26T14:00:00.000Z"
          },
          {
            "_id": "654321098765432109876546",
            "name": "Global Project B",
            "contextId": "projectDEF",
            "contextType": "project",
            "ownerId": "anotherAdmin",
            "isArchived": false,
            "createdAt": "2023-10-26T15:00:00.000Z",
            "updatedAt": "2023-10-26T15:00:00.000Z"
          }
        ],
        "totalCount": 2
      }
    }
  • Example (cURL):

    curl -X POST https://api.example.com/api/rpc \
      -H "Content-Type: application/json" \
      -H "X-API-Key: YOUR_API_KEY" \
      -d '{
        "method": "TaskManagerRpc.listAll",
        "params": {
          "filter": {
            "ownerId": "adminUser"
          },
          "page": 1,
          "pageSize": 10
        }
      }'