Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Inquiry: Batch/Bulk PATCH support for /rest/v3/devices

Answered

Comments

1 comment

  • Norman
    • Network Optix team

    Hi Miguel Dina,

    You are on the right track using the PATCH /rest/v3/devices/{id} endpoint; this is precisely the request needed for this task. To streamline the process, you can follow these steps:

    1. Retrieve Existing Device Data
    First, you will need to identify the unique IDs of the devices you wish to rename. I recommend filtering the output to include only the essential fields: id, name, and url (which contains the IP address). You can execute this via the following request:

    GET /rest/v4/devices?_format=CSV&_with=id,name,url

    I have specified the CSV format here, as it is generally easier to manipulate in spreadsheet software of a simple text editor, compared to the default JSON or XML formats. 

    This request will generate a file named devices.csv.

    2. Prepare and Execute the Update
    Once you have the file, you can simply update the "name" column with your preferred titles. After saving your changes, you can use a script to iterate through the CSV and send a PATCH request for each entry, replacing the {id} placeholder with the actual ID from your list with a loop.

    To assist with this, I have drafted a basic .bat script which you can find HERE. It is designed as a starting point, so please feel free to adapt it to your specific environment or requirements.

    With kind regards. 

    0

Please sign in to leave a comment.