AppMage

Document Management

This endpoint group provides methods for managing documentation content, including retrieving, creating, updating, and deleting documents, as well as performing semantic searches within documentation instances.

Endpoints

POST /api/rpc (Method: DocumentRpc.getAllDocuments)

  • Description: Gets all documents for a specific documentation instance.

  • Request Body:

    {
      "method": "DocumentRpc.getAllDocuments",
      "params": {
        "documentInstanceId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    documentInstanceId String Yes The ID of the documentation instance.
  • Response:

    {
      "success": true,
      "data": {
        "data": [
          {
            "_id": "string",
            "uuid": "string (UUID)",
            "documentInstanceId": "string",
            "title": "string",
            "content": "string",
            "parentId": "string",
            "tags": [
              "string"
            ],
            "version": "number",
            "isArchived": "boolean",
            "createdAt": "Date",
            "updatedAt": "Date",
            "createdBy": "string",
            "lastModifiedBy": "string"
          }
        ],
        "totalCount": "number"
      }
    }
  • 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": "DocumentRpc.getAllDocuments",
        "params": {
          "documentInstanceId": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: DocumentRpc.getById)

  • Description: Gets a single document by its ID.

  • Request Body:

    {
      "method": "DocumentRpc.getById",
      "params": {
        "docId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    docId String Yes The unique identifier of the document.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "uuid": "string (UUID)",
        "documentInstanceId": "string",
        "title": "string",
        "content": "string",
        "parentId": "string",
        "tags": [
          "string"
        ],
        "version": "number",
        "isArchived": "boolean",
        "createdAt": "Date",
        "updatedAt": "Date",
        "createdBy": "string",
        "lastModifiedBy": "string"
      }
    }
  • 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": "DocumentRpc.getById",
        "params": {
          "docId": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: DocumentRpc.getByTitle)

  • Description: Gets a single document by its Title within an instance.

  • Request Body:

    {
      "method": "DocumentRpc.getByTitle",
      "params": {
        "documentInstanceId": "string",
        "title": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    documentInstanceId String Yes The ID of the documentation instance.
    title String Yes The title of the document.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "uuid": "string (UUID)",
        "documentInstanceId": "string",
        "title": "string",
        "content": "string",
        "parentId": "string",
        "tags": [
          "string"
        ],
        "version": "number",
        "isArchived": "boolean",
        "createdAt": "Date",
        "updatedAt": "Date",
        "createdBy": "string",
        "lastModifiedBy": "string"
      }
    }
  • 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": "DocumentRpc.getByTitle",
        "params": {
          "documentInstanceId": "654321098765432109876543",
          "title": "My Document Title"
        }
      }'

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

  • Description: Creates a new document.

  • Request Body:

    {
      "method": "DocumentRpc.create",
      "params": {
        "title": "string",
        "content": "string",
        "parentId": "string",
        "documentInstanceId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    title String Yes The title of the document.
    content String No The Markdown content of the document.
    parentId String No The _id of the parent document, if this is a sub-document.
    documentInstanceId String Yes Links this document to its DocumentInstance container.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "uuid": "string (UUID)",
        "documentInstanceId": "string",
        "title": "string",
        "content": "string",
        "parentId": "string",
        "tags": [
          "string"
        ],
        "version": "number",
        "isArchived": "boolean",
        "createdAt": "Date",
        "updatedAt": "Date",
        "createdBy": "string",
        "lastModifiedBy": "string"
      }
    }
  • 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": "DocumentRpc.create",
        "params": {
          "documentInstanceId": "654321098765432109876543",
          "title": "New Document",
          "content": "# My New Document\nThis is the content.",
          "parentId": null
        }
      }'

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

  • Description: Updates a document.

  • Request Body:

    {
      "method": "DocumentRpc.update",
      "params": {
        "_id": "string",
        "title": "string",
        "content": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The unique identifier of the document to update.
    title String No The new title for the document.
    content String No The new Markdown content for the document.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "uuid": "string (UUID)",
        "documentInstanceId": "string",
        "title": "string",
        "content": "string",
        "parentId": "string",
        "tags": [
          "string"
        ],
        "version": "number",
        "isArchived": "boolean",
        "createdAt": "Date",
        "updatedAt": "Date",
        "createdBy": "string",
        "lastModifiedBy": "string"
      }
    }
  • 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": "DocumentRpc.update",
        "params": {
          "_id": "654321098765432109876543",
          "title": "Updated Document Title",
          "content": "This content has been updated."
        }
      }'

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

  • Description: Deletes a document and all of its sub-pages.

  • Request Body:

    {
      "method": "DocumentRpc.delete",
      "params": {
        "_id": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes The unique identifier of the document to delete.
  • Response:

    {
      "success": true,
      "data": {
        "success": "boolean",
        "deletedCount": "number"
      }
    }
  • 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": "DocumentRpc.delete",
        "params": {
          "_id": "654321098765432109876543"
        }
      }'

POST /api/rpc (Method: DocumentRpc.search)

  • Description: Performs a semantic search within a specific documentation instance.

  • Request Body:

    {
      "method": "DocumentRpc.search",
      "params": {
        "documentInstanceId": "string",
        "queryText": "string",
        "topK": "number",
        "filter": "any"
      }
    }
  • Parameters:

    Name Type Required Description
    documentInstanceId String Yes The ID of the documentation instance to search within.
    queryText String Yes The natural language query for the semantic search.
    topK Number No The maximum number of relevant results to return. Defaults to 5.
    filter Any No An optional filter object to apply to the search results.
  • Response:

    {
      "success": true,
      "data": [
        {
          "id": "string (UUID)",
          "payload": {
            "content": "string",
            "metadata": {
              "title": "string",
              "mongoId": "string"
            }
          },
          "score": "number"
        }
      ]
    }
  • 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": "DocumentRpc.search",
        "params": {
          "documentInstanceId": "654321098765432109876543",
          "queryText": "How do I get started with AppBuilder?",
          "topK": 3
        }
      }'