Workflow considerations for using REST API to set Client Settings on a system-wide scale

The main wisdom I’d lend, from hard-won experience, is to start small :slight_smile:

Posting to ‘/api/computer/{computer id}/{setting name}’ does have a side-effect to consider - you can only access that as a Master Operator account, and when you do, a Global Property is also created to retrieve the value of that client setting (the main reason I try to avoid using that endpoint).

To some extent it depends on how private you need these values to be. If you post to /api/actions and use a computer list, a separate copy of the action is sent to each computer’s mailboxsite; this can be a bit of work on the server but lightens the load on the clients, as only the targeted clients even see that the action exists. But if it’s tens of values on thousands of computers it can add up.

One technique you might consider is, instead of issuing actions, posting to a Site’s ClientFiles resource, and uploading a file with key/value pairs. If these are fairly public properties, like “computername to sitename” mappings, you could have a single file with thousands of computers in it like

computername1:value
computername2:value

and then a single Action on the clients that updates their client setting with the rows from the file that match their computername, checking whenever the file is updated.

If you need the values to be private, though, you could post an individual file for each computer to the computers’ mailboxsite (which, also, requires Master Operator permissions). This is the technique used by the ServiceNow Data Flow integration, to balance server workload and site updates, so I know it scales well at least into the tens of thousands.

If you use a common file in a custom site, you can have relevance in a Task that checks for the date on it, something like

exists file "MySettingsFile.txt" of client folder of current site and not exists settings "MyClientSetting" whose (effective time of it > modification time of file "MySettingsFile.txt" of client folder of current site)

This makes the Task relevant if the client setting doesn’t exist, or if the configuration file is newer than the client setting value.

Then in ActionScript you’d do something like

setting "MyClientSetting"="{following texts of firsts ":" of lines whose (it as lowercase starts with (computer name as lowercase & ":") of files "MySettingsFile.txt" of client folder of current site}" on "{now}" for client

You can do the same with files in mailboxsites, just adjusting the client path a bit like client folder of site "mailboxsite"

Or, you can use a technique like the “Location Property Wizard” - which accepts a text blob of key/value pairs mapping computers to values, and then generates a really long relevance statement to match each computer to the desired values.

3 Likes