Update Physical Device icon

Update Physical Device

Update a physical device

Overview

This node updates the details of a physical device by sending an HTTP PUT request to a specified API endpoint. It is useful in scenarios where you need to programmatically modify device information such as name, description, serial number, or IP address within a network management or asset tracking system.

Practical examples include:

  • Updating device metadata after maintenance or relocation.
  • Synchronizing device information from an external inventory system.
  • Automating bulk updates of device records based on changing configurations.

Properties

Name Meaning
Device ID The unique identifier of the device to update (e.g., "device-123").
Device Name The new or updated name for the device (e.g., "My Device").
Description A textual description providing details about the device (e.g., "Device description").
Serial Number The serial number associated with the device (e.g., "SN123456789").
IP Address The IP address assigned to the device (e.g., "192.168.1.100").

Output

The node outputs a JSON object for each input item processed, containing:

  • success: Boolean indicating if the update was successful.
  • message: A message returned from the API or a default success message.
  • deviceId: The ID of the device that was updated.
  • name: The updated device name.
  • description: The updated device description.
  • serialNumber: The updated serial number.
  • ip: The updated IP address.
  • response: The full response object returned from the API call.

If an error occurs and the node is configured to continue on failure, the output will contain:

  • success: false
  • error: The error message.
  • statusCode: HTTP status code of the failed request.
  • response: The response body or error details from the API.
  • deviceId: The device ID for which the update failed.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential to authenticate requests to the firewall or device management API.
  • The API base URL is retrieved from the credentials configuration.
  • The node sends HTTP PUT requests to the endpoint /api/pt/devices on the configured API server.
  • The request includes headers specifying content type as JSON and sets the "Accept-Language" header to Vietnamese (vi).

Troubleshooting

  • Common issues:

    • Invalid or missing device ID causing the API to reject the update.
    • Network connectivity problems preventing access to the API endpoint.
    • Authentication failures due to incorrect or expired API credentials.
    • Malformed input data leading to validation errors on the server side.
  • Error messages:

    • Errors include detailed messages, HTTP status codes, and response bodies when available.
    • If the node fails to update a device and is not set to continue on failure, it throws a descriptive error including the device ID, status code, response content, and request body for easier debugging.
  • Resolution tips:

    • Verify all required properties are correctly filled and valid.
    • Check API credentials and ensure they have proper permissions.
    • Confirm the API server URL is reachable and correct.
    • Enable "Continue On Fail" option to allow processing of multiple items even if some fail.

Links and References

  • Refer to your device management or firewall API documentation for details on the /api/pt/devices endpoint and expected payload structure.
  • n8n HTTP Request node documentation for understanding HTTP methods and error handling: https://docs.n8n.io/nodes/n8n-nodes-base.httpRequest/

Discussion