Unexpected data loss when using PATCH method with Automic Automation REST API
search cancel

Unexpected data loss when using PATCH method with Automic Automation REST API

book

Article ID: 443792

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

When using the PATCH method to update objects via the Automic Automation REST API, users may experience unexpected data loss. While many REST implementations use PATCH for partial updates to specific fields, the Automic Automation API implementation may strip attributes within an array or object if they are not explicitly included in the PATCH payload.

 

Symptoms 

After performing a PATCH request to update a specific attribute of an object (such as a VARA value or an RA FTP connection setting), other attributes within the same section are deleted or reset to default values.

 

Examples of unexpected behavior:

  1. RA FTP Connection Objects: Updating the value of a host destination without including "is_connection": 1 results in the connection being treated as a local file system path because the is_connection flag is reset to 0.
  2. VARA Objects: Updating value1 in a static VARA via PATCH without including value2 through value5 results in the removal of the data in columns 2-5.

Environment

  • Automation Engine 24+
  • Automic Automation REST API

Cause

The PATCH method in the Automic Automation API does not perform a "deep merge" for all object types. When updating arrays or nested structures (like static_values or RA attributes), the API often replaces the existing array/structure with the new one provided in the payload. Any existing data omitted from the payload is removed.

Resolution

Resolution To prevent data loss when using the PATCH method, follow these best practices:

  1. Perform a GET First: Always execute a GET request on the object to retrieve the current full data structure.
  2. Include All Nested Attributes: In your PATCH payload, include the full array or object structure for the section you are modifying, ensuring all existing values you wish to keep are present alongside your changes.
  3. Backup Objects: Create a backup or duplicate of the object before performing bulk or automated API updates.
  4. Test in Non-Production: Validate API logic in a Development or Sandbox environment to ensure the PATCH behavior matches expectations for the specific object type.

 

Example: Safe Update for VARA values To update value1 while preserving value2-5, the payload must include all columns:

{
  "data": {
    "vara": {
      "static_values": [
        {
          "key": "####",
          "validity_range": "FREI",
          "value1": "UPDATED_VALUE",
          "value2": "EXISTING_VALUE",
          "value3": "EXISTING_VALUE",
          "value4": "EXISTING_VALUE",
          "value5": "EXISTING_VALUE"
        }
      ]
    }
  }
}

 

 

Additional Information

For more details on REST API structures, see the AE REST API documentation.