Skip to main content

Endpoints

Create a New Agent

  • URL: /api/agent/new
  • Method: POST
  • Description: Create a new agent and store its information in a MySQL database.
  • Request Body:
    • versionOS (required): The version of the operating system running on the agent.
    • host (required): The host name or IP address of the agent.
    • hookUser (required): The hook user of the agent.
  • Response:
    • Status Code: 200 OK on success, 400 Bad Request if parameters are missing or invalid, 500 Internal Server Error if an error occurs during database insertion.
    • Response Body:
{
  "data": {
    "id": "<agentId>",
    "publicKey": "<publicKey>"
  },
  "error": {}
}
  • Example:
POST /api/agent/new HTTP/1.1
Host: localhost:5000
Content-Type: application/json

{
  "versionOS": "1.0",
  "host": "example.com",
  "hookUser": "john.doe"
}

Upload a File

  • URL: /api/file/upload/:user_folder
  • Method: POST
  • Description: Upload a file and save it in the specified user folder.
  • Request Parameters:
    • user_folder (required): The user folder to which the file should be uploaded.
  • Request Body:
    • The file to be uploaded should be sent as multipart/form-data with the file field name set to file.
  • Response:
    • Status Code: 200 OK on success, 400 Bad Request if no file is uploaded.
    • Response Body:
{
  "data": {
    "success": "<filename> uploaded successfully."
  },
  "error": {}
}
  • Example:
POST /api/file/upload/123 HTTP/1.1
Host: localhost:5000
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="example.txt"
Content-Type: text/plain

This is the content of the file.

------WebKitFormBoundary7MA4YWxkTrZu0gW--