Sorry, i did this one a bit freestyle without testing. This is out of the interactive API:
{
"ruleset": "host_label_rules",
"folder": "~hosts~linux",
"properties": {
"disabled": false
},
"value_raw": "\"{'cmk/os_family': 'linux'}\"",
"conditions": {}
}
Place this in the json from above and edit the attributes to your needs.