RTILA Cloud API Documentation

Overview

RTILA Cloud API provides a set of endpoints for managing and executing cloud-based automation projects. The API supports project uploading, execution, results retrieval, and bot management.

Base URL

The API is accessible via HTTP/HTTPS. WebSocket connections are used for real-time process monitoring.

Authentication

All API endpoints (except / and /bots/:uniqueId GET) require authentication via a license key query parameter.

Query Parameter:

Example:

GET /me?key=your-license-key

API Endpoints

Health Check

GET /

Check if the API service is running.

JavaScript Example:

fetch("https://cloud.rtila.net/")
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response:

{
  "status": true,
  "message": "Welcome to RTILA Cloud!",
  "timestamp": 1699812345678
}

User Information

GET /me

Retrieve authenticated user information and update usage statistics.

JavaScript Example:

const licenseKey = "your-license-key";

fetch(`https://cloud.rtila.net/me?key=${licenseKey}`)
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response:

{
  "license": "license-key",
  "email": "[email protected]",
  "activations_left": 5,
  "plan_name": "10 Machine(s)"
}

Project Management

POST /upload-project

Upload a new project or update an existing one. This endpoint serves two main purposes:

  1. Automatic Cloud Execution:

    • Used automatically by the RTILA software when selecting "Cloud run" option
    • In this case, it's called with autoLaunch=true
    • Handles the complete upload and execution process in one step
  2. Manual Project Upload:

    • Can be called directly for manual project management
    • Accepts .bot files (NOT .rtila files)
    • .bot files can be generated from the "Bots" section of the software
    • Once uploaded, projects can be launched later using the /launch endpoint

Important Notes:

Authentication Required: Yes

Query Parameters:

Request Body:

{
  "data": "Project configuration in JSON format (.bot file content)",
  "variables": {
    "key1": "value1",
    "key2": "value2"
  }
}

JavaScript Example:

const licenseKey = "your-license-key";
const botFile = await fs.readFile("path/to/your/project.bot", "utf8");

const projectData = {
  data: botFile,
  variables: {
    key1: "value1",
    key2: "value2",
  },
};

// Upload without auto-launch
fetch(`https://cloud.rtila.net/upload-project?key=${licenseKey}`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(projectData),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

// Upload with auto-launch (similar to "Cloud run" in software)
fetch(`https://cloud.rtila.net/upload-project?key=${licenseKey}&autoLaunch=true`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(projectData),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response for Manual Upload:

{
  "status": true,
  "message": "Cloud project uploaded successfully"
}

Response for Auto-Launch:

{
  "status": true,
  "message": "Cloud project launched successfully",
  "projectId": "project-uuid",
  "sessionId": "session-id"
}

POST /launch

Launch an existing project that was previously uploaded via the /upload-project endpoint.

Key Points:

Authentication Required: Yes

Query Parameters:

Request Body:

{
  "variables": {
    "key1": "value1",
    "key2": "value2"
  }
}

JavaScript Example:

const licenseKey = "your-license-key";
const projectId = "your-project-uuid"; // From "Options" section
const variables = {
  key1: "value1",
  key2: "value2",
};

fetch(`https://cloud.rtila.net/launch?key=${licenseKey}&pid=${projectId}`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ variables }),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response:

{
  "status": true,
  "message": "Cloud project launched successfully",
  "projectId": "project-uuid",
  "sessionId": "session-id"
}

Results Retrieval

GET /results/:projectUid/:sessionId

Retrieve project execution results.

JavaScript Example:

const licenseKey = "your-license-key";
const projectUid = "your-project-id";
const sessionId = "your-session-id";

fetch(`https://cloud.rtila.net/results/${projectUid}/${sessionId}?key=${licenseKey}`)
  .then((response) => {
    if (response.status === 202) {
      console.log("Project still running");
      return;
    }
    return response.json();
  })
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response States:

{
  "completedAt": "2024-11-12T12:00:00.000Z",
  "datasets": [
    {
      "name": "filename.json",
      "data": {}
    }
  ]
}
{
  "status": "running"
}
{
  "error": "Process encountered an error"
}
{
  "error": "Results not found"
}

Bot Management

POST /bots

Store bot configuration.

Authentication Required: Yes

Request Body:

{
  "uniqueId": "bot-unique-id",
  "data": {
    // Bot configuration
  }
}

JavaScript Example:

const licenseKey = "your-license-key";
const botData = {
  uniqueId: "bot-unique-id",
  data: {
    // Bot configuration
  },
};

fetch(`https://cloud.rtila.net/bots?key=${licenseKey}`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify(botData),
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

Response:

{
  "status": true
}

GET /bots/:uniqueId

Retrieve bot configuration.

Authentication Required: No

JavaScript Example:

const botId = "bot-unique-id";

fetch(`https://cloud.rtila.net/bots/${botId}`)
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));

WebSocket Interface

The WebSocket interface provides real-time updates for project execution.

JavaScript Example:

const licenseKey = "your-license-key";
const ws = new WebSocket("ws://cloud.rtila.net:8080");

// Initialize connection
ws.onopen = () => {
  ws.send(
    JSON.stringify({
      action: "initialize",
      data: {
        license: licenseKey,
      },
    })
  );
};

// Handle messages
ws.onmessage = (event) => {
  const message = JSON.parse(event.data);

  switch (message.action) {
    case "log":
      console.log(`Project ${message.data.uuid}: ${message.data.message}`);
      break;
    case "finished":
      console.log(`Project ${message.data.uuid} completed`);
      break;
  }
};

// Stop a project
function stopProject(projectId) {
  ws.send(
    JSON.stringify({
      action: "stop",
      data: {
        license: licenseKey,
        project: projectId,
      },
    })
  );
}

// Handle connection closure
ws.onclose = () => {
  console.log("WebSocket connection closed");
};

Error Handling Example

async function makeApiRequest(endpoint, options = {}) {
  try {
    const response = await fetch(`https://cloud.rtila.net${endpoint}`, options);

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(errorData.message || "API request failed");
    }

    return await response.json();
  } catch (error) {
    console.error("API Error:", error.message);
    throw error;
  }
}

File Size Limits

Maximum file upload size: 20MB

Notes