We recommend only attempting to amend Custom Fields that will not be updated otherwise through other methods, Inventory for example. 'Administrator' Data Types are the most obvious choice.
The things we'll need to know to write a script:
- FileWave server address
- Base64 Encoded API token (from Assistants → Manage Administrators, and highly recommend a new admin account for this that has no rights assigned)
- The Internal Name of the field you want to update
- The type of Custom Field (string, boolean, integer, date/time)
- The Device ID of the device you want to test with (in an actual script, FileWave can supply this automatically through a launch argument)
How to be Smart:
We can be smart by asking the API to show us data for Custom Fields we want to update. So, we'll look at details for a specific device that has values set. (Note this is a desktop client so we used /DesktopClient, but if a mobile device then it would be /MobileClient instead). Elements in blue would need to be replaced with values for your environment.
As you can see, the results above are the same from the API regardless of calling platform and the data for the Custom Field is in the form of an array, so when we go to change it, we'll write it back that way as well using the PATCH command and an array data structure.
The basic method for changing a value looks like this, where you would again substitute your values and environment info:
$api = "https://" + $server + ":20443/inv/api/v1/client/" + $args
Practical Examples (differing data types):
Using %device_id% as a Launch Argument.
Self-Signed certificates may produce an error around SSL Certificates. Please act accordingly, based upon the script output, to address this.
|Content by Label|