Ajax icon

Ajax

Consume Ajax API (v.0.1.2)

Actions242

Overview

The node named "Ajax" is designed to interact with a backend Ajax API, providing a flexible interface to perform various operations on multiple resources. Specifically, for the Camera resource and the Link Camera to Hub operation, this node links a camera device to a specified hub within a system. This is useful in scenarios where cameras need to be organized or managed under hubs (central controllers or aggregators), such as in security systems, smart home setups, or surveillance networks.

Practical examples include:

  • Adding a new IP camera to an existing security hub.
  • Organizing cameras by rooms and hubs for easier management.
  • Integrating different camera service types (e.g., RTSP streams, Hikvision, Dahua) into a unified monitoring platform.

Properties

Name Meaning
User Id Identifier of the user who owns or manages the camera.
Hub Id Identifier of the hub to which the camera will be linked.
Room Id Identifier of the room where the camera is physically located or logically assigned.
Camera Name The display name for the camera being linked.
Service Type The type of camera service or protocol used. Options: RTSP_STREAM, XMEYE, HIKVISION, DAHUA, IVIDEON, SAFIRE, UNIVIEW.
Stream Data Url URL or endpoint providing the stream data for the camera.
Dvr Boolean flag indicating whether the camera supports or uses DVR (Digital Video Recorder) functionality.
Parent Camera Id Optional identifier of a parent camera if this camera is part of a multi-camera setup or hierarchy.

Output

The node outputs JSON data representing the result of the link operation. This typically includes confirmation details such as the linked camera's ID, status, and any metadata returned by the backend API confirming successful linkage.

If the node supports binary data output (not explicitly shown in the provided code), it would likely relate to camera stream snapshots or video clips, but this is not evident from the static analysis.

Dependencies

  • Requires an API key credential for authenticating with the Ajax backend API.
  • Depends on the @digital-boss/n8n-designpatterns package for operation resolution and execution patterns.
  • Uses internal backend modules (State, operations, HttpClient) to manage state, define operation methods, and handle HTTP requests respectively.
  • The node expects proper configuration of the Ajax API credentials within n8n.

Troubleshooting

  • Common issues:

    • Missing or invalid API credentials can cause authentication failures.
    • Incorrect or missing required properties (e.g., User Id, Hub Id) will prevent successful linking.
    • Unsupported or misspelled service types may lead to errors or failed connections.
    • Network connectivity problems to the backend API or camera stream URLs.
  • Error messages:

    • Authentication errors usually indicate invalid or missing API keys; verify credentials.
    • Validation errors point to missing required parameters; ensure all required fields are filled.
    • HTTP request failures might suggest network issues or incorrect URLs; check connectivity and URLs.

Links and References

  • No direct external links are provided in the source code.
  • For more information on supported camera service types, consult the respective camera manufacturer documentation (e.g., Hikvision, Dahua).
  • Refer to the Ajax API documentation (if available) for detailed API usage and error codes.

Discussion