Many Thanks @Pierre-Nicolas!
I was able to use this syntax to create the following shell script.
#!/bin/bash
#Set the following environment variables (within the fileset's executable tab): apitoken, clientID, customFieldName, flag
#ENV variable advice...
# customFieldName: Use the "Internal Name" which can be found in the Assistants --> Custom Field menu in FileWave Admin.
# flag: true or false
# clientID should be set to %filewave_id%
serverURL="https://lifeisgood.filewave.net:20445/inv/api/v1/custom_field/set_association"
curl -X POST $serverURL \
-H "accept: application/json" \
-H "Authorization: $apitoken" \
-H "Content-Type: application/json" \
-H 'cache-control: no-cache' \
-d "{\"client_ids\" : [$clientID], \"fields\" : {\"$customFieldName\" : $flag }}"
#JSON data without using variables: -d "{\"client_ids\" : [3092211, 123, 77],\"fields\" : {\"printNode_computerID\" : true}}"
exit 0
I would also love to create a Windows-friendly fileset. However, I'm having issues creating a fully-functional PowerShell script. Currently, the script does not produce an error message. However, when I check FileWave Admin, I can see that the custom field is not being associated to the target device.
My suspicion is that I'm experiencing a syntax-related issue with the line that contains the JSON Data. Can someone help me correct my $data payload?
$server = "FQDN_GOES_HERE"
$token = "API_Token_GOES_HERE"
$customFieldName = "CF_Name_GOES_HERE"
$api = "https://" + $server + ":20445/inv/api/v1/custom_field/set_association/"
$header = @{Authorization=$token}
$date = Get-Date -Format "o"
#Data (Attempt 1)
#REPLACE CLIENT ID!
$flag = 1
#$data = '{"client_ids" : [3092254], "fields" : {"' + $customFieldName + '" : {"exitCode":null,"status":0,"updateTime":"' + $date + '","value":"' + $flag + '"}}}'
# Data (Attempt 2)
#REPLACE CLIENT ID!
$flag = "true"
$data = '{"client_ids" : [3092254], "fields" : {"' + $customFieldName + '" : ' + $flag + '}}'
Invoke-RestMethod -Method POST -Headers $header -Body $data -ContentType application/json -Uri $api
exit 0