Ajax icon

Ajax

Consume Ajax API (v.0.1.2)

Actions242

Overview

The node named "Ajax" is designed to interact with the Ajax API (version indicated in the bundled source). It supports multiple resources and operations, including the "Hub" resource with the "Send Panic Command" operation. This particular operation allows users to send a panic alert command to a specified hub device associated with a user. Such functionality is beneficial in security or emergency response scenarios where immediate alerts need to be triggered remotely.

Practical examples include:

  • Triggering an emergency alarm on a security hub when suspicious activity is detected.
  • Sending a panic signal from a monitoring system to a user's hub device during an incident.
  • Integrating with automation workflows that require remote activation of safety protocols.

Properties

Name Meaning
User Id The unique identifier of the user associated with the hub to which the panic command will be sent.
Hub Id The unique identifier of the hub device that will receive the panic command.
Location Optional collection of location data to accompany the panic command, including:
- Latitude: Geographic latitude coordinate.
- Longitude: Geographic longitude coordinate.
- Accuracy: Accuracy of the location measurement.
- Speed: Speed at which the device/user is moving.
- Timestamp: Time at which the location was recorded (epoch time).

Output

The node outputs JSON data representing the result of the panic command request sent to the Ajax API. This typically includes confirmation of the command being accepted or details about any errors encountered. The exact structure depends on the API response but generally contains status information and possibly metadata about the command execution.

If the node supports binary data output, it would relate to any binary payloads returned by the API, but based on the provided code and properties, the primary output is JSON.

Dependencies

  • Requires an API key credential for authenticating with the Ajax API.
  • Depends on the HttpClient class for making HTTP requests to the backend Ajax API.
  • Utilizes internal modules for state management and operation resolution/execution.
  • Needs proper configuration of the API credentials within n8n to function correctly.

Troubleshooting

  • Common Issues:

    • Missing or invalid API credentials can cause authentication failures.
    • Incorrect User Id or Hub Id values may lead to errors indicating that the target device or user was not found.
    • Providing incomplete or malformed location data might cause the API to reject the request or ignore the location info.
  • Error Messages:

    • Authentication errors usually indicate issues with the API key; verify the credential setup.
    • Validation errors related to required parameters (User Id, Hub Id) suggest missing inputs.
    • Network or timeout errors imply connectivity problems between n8n and the Ajax API endpoint.

Resolving these typically involves verifying input parameters, ensuring valid credentials, and checking network connectivity.

Links and References

Discussion