Well I came up with a very dirty solution on this that seems to work and I'll go with it until something more elegant comes up. I create my REST service names such that I can derive the desired key field values from them. Then I wrote an SOI that:
- intercepts all "applyEdit" REST requests
- Gets the service name it's running on behalf of (from the server environment "CfgName" property) and derives the desired key field value. For example if the service name is "COMPANYA_WIDGETS", the derived key value is "COMPANYA"
- Digs into the received json and sets the key field is being set to the desired value before passing it on to be processed by the server. I simply did a regular expression replacement like this:
string pattern = "\"Org_ID\":\"[^\"]*\",";
operationInput = Regex.Replace(operationInput, pattern, "\"Org_ID\":\"" + orgID + "\",");