Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip

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.

Changing Values:

The basic method for changing a value looks like this, where you would again substitute your values and environment info:

...

Windows

$api = "https://" + $server + ":20443/inv/api/v1/client/" + $args[0]







macOShttps://$SERVER:20443/inv/api/v1/client/$1


Practical Examples (differing data types):

Using %device_id% as a  Launch Argument.

...

Info
titleSSL Certificate Problem

Self-Signed certificates may produce an error around SSL Certificates.  Please act accordingly, based upon the script output, to address this.




Content by Label
showLabelsfalse
max5
spacesKB
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel = "kb-how-to-article" and type = "page" and space = "KB"
labelskb-how-to-article

...